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 ...
随机推荐
- GetMapping 和 PostMapping最大的差别(转)
原文地址:GetMapping 和 PostMapping Spring4.3中引进了{@GetMapping.@PostMapping.@PutMapping.@DeleteMapping.@Pa ...
- SpringCloud 将服务注册到Eureka Server上
提供好服务生产者: 1.添加spring-cloud-starter-eureka依赖 <dependencyManagement> <dependencies> <de ...
- Maven依赖标红线,非jar包冲突问题
Maven依赖标红线 在pom中引入依赖fastdfs-client时,该依赖可以正常引入,但是查看Maven Project时,该依赖下总是有几个依赖报红线,并不是依赖冲突,测试代码无法正常运行.想 ...
- 部署项目到linux中报Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed
@RequestMapping(value = "/security/login", method = RequestMethod.POST) public ModelAndVie ...
- dubbo 自定义 Filter
通过自定义 Filter,可以在 dubbo 调用链中加入特定的逻辑,比如埋点分析调用链. 1. 新建 Filter 类 // @Activate(group = {Constants.CONSUME ...
- Linux磁盘性能分析(CentOS)
1.top查看CPU是否长时间等待IO top %wa超过30%,说明IO压力很大 2.iostat查看磁盘工作时长占比 iostat -x #1表示1秒刷新一次 %util表示在过去的时间段中磁盘进 ...
- which/whereis/locate/find的区别
which--在$PATH目录下查找文件 whereis--在预定目录下(whereis -l查看)查找文件 locate--在数据库中查找目录或文件 find--遍历目录查找文件 说明: 1.关于w ...
- linux 添加环境变量(php为例)
find / -name php vim /etc/profile 文件最后添加 export PATH=$PATH:/usr/local/php/bin source /etc/profile p ...
- 尚学堂java答案解析 第二章
本答案为本人个人编辑,仅供参考,如果读者发现,请私信本人或在下方评论,提醒本人修改 一.选择题: 1.CD 解析:A public是关键字. B 第一个不能是数字 2.C 解析:j=i++ < ...
- unity中制作模拟第一人称视角下的指南针
private int zRotation; public GameObject obj; public void Update() { //obj = GameObject.Find("C ...