HDU 3130 17多校7 Kolakoski(思维简单)
For each test case:
A single line contains a positive integer n(1≤n≤107).
A single line contains a nonnegative integer, denoting the answer.
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=1e7+;
int a[maxn];
int b[maxn]; void pre()
{
int cnta=,cntb=;
a[]=;b[]=;b[]=;
for(cnta=,cntb=;cnta<maxn&&cntb<maxn;cnta++)
{
a[cnta]=b[cnta];
if(a[cnta]==)
{
if(b[cntb]==)
{
b[cntb+]=;
}
else
{
b[cntb+]=;
}
cntb++;
}
else
{
if(b[cntb]==)
{
b[cntb+]=;
b[cntb+]=;
}
else
{
b[cntb+]=;
b[cntb+]=;
}
cntb+=;
}
}
} int main()
{
pre();
int T,n;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
printf("%d\n",b[n]);
}
return ;
}
HDU 3130 17多校7 Kolakoski(思维简单)的更多相关文章
- HDU 6140 17多校8 Hybrid Crystals(思维题)
题目传送: Hybrid Crystals Problem Description > Kyber crystals, also called the living crystal or sim ...
- HDU 6124 17多校7 Euler theorem(简单思维题)
Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amodb. Bu ...
- HDU 6034 17多校1 Balala Power!(思维 排序)
Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. He want ...
- HDU 6098 17多校6 Inversion(思维+优化)
Problem Description Give an array A, the index starts from 1.Now we want to know Bi=maxi∤jAj , i≥2. ...
- HDU 6092 17多校5 Rikka with Subset(dp+思维)
Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he ...
- HDU 6090 17多校5 Rikka with Graph(思维简单题)
Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he ...
- HDU 6095 17多校5 Rikka with Competition(思维简单题)
Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he ...
- HDU 6049 17多校2 Sdjpx Is Happy(思维题difficult)
Problem Description Sdjpx is a powful man,he controls a big country.There are n soldiers numbered 1~ ...
- HDU 6143 17多校8 Killer Names(组合数学)
题目传送:Killer Names Problem Description > Galen Marek, codenamed Starkiller, was a male Human appre ...
随机推荐
- 什么是CSS hack?
1.什么是CSS hack? CSS hack是通过在CSS样式中加入一些特殊的符号,让不同的浏览器识别不同的符号(什么样的浏览器识别什么样的符号是有标准的,CSS hack就是让你记住这个标准),以 ...
- python爬虫---BeautifulSoup的用法
BeautifulSoup是一个灵活的网页解析库,不需要编写正则表达式即可提取有效信息. 推荐使用lxml作为解析器,因为效率更高. 在Python2.7.3之前的版本和Python3中3.2.2之前 ...
- suffix word al ain aire out ~A1
1◆ al 2◆ ain ~的人 3◆ aire 表名词
- sigmoid belief network boltszmann machine
because of explaining away, the hidden weights in sigmoid belief network is no longer independent
- POJ 2243 Knight Moves(BFS)
POJ 2243 Knight Moves A friend of you is doing research on the Traveling Knight Problem (TKP) where ...
- 普通01背包问题(dp)
有n个物品,重量和价值分别为wi和vi,从这些物品中挑选出重量不超过W的物品,求所有挑选方案中物品价值总和的最大值 限制条件: 1 <= n <= 100; 1 <= wi,vi & ...
- webpack分离打包css和less
github仓库:https://github.com/llcMite/webpack.git 为什么要分离打包? 答:刚开始学webpack的时候就很郁闷,明明没几个文件,打包出来体积特 ...
- day25 模块04_模块和包
休养生息--模块04 1.导入模块的执行的步骤 2.自定义模块 3.自定义包 一.导入模块的执行步骤 1).判断当前正在导入的模块是否已经导入过 2).如果已经导入过,不会重新导入该模块 3).如果没 ...
- linux生成SSH key
1. 检查SSH keys是否存在 ls -al ~/.ssh2. 生成新的ssh key 输入 ssh-keygen -t rsa -C your_email@example.com
- svn服务器搭建及使用(三)
接下来,试试用TortoiseSVN修改文件,添加文件,删除文件,以及如何解决冲突等. 添加文件 在检出的工作副本中添加一个Readme.txt文本文件,这时候这个文本文件会显示为没有版本控制的状态, ...