题意:由1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,……合并可得1,22,11,2,1,22,1,22,11,2,11,22,1,再由每个数的位数可得新序列,推出新序列第n项。

分析:新序列与原序列相同,按题意打表即可。

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#define lowbit(x) (x & (-x))
const double eps = 1e-8;
inline int dcmp(double a, double b){
if(fabs(a - b) < eps) return 0;
return a > b ? 1 : -1;
}
typedef long long LL;
typedef unsigned long long ULL;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const LL LL_INF = 0x3f3f3f3f3f3f3f3f;
const LL LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const int dr[] = {0, 0, -1, 1, -1, -1, 1, 1};
const int dc[] = {-1, 1, 0, 0, -1, 1, -1, 1};
const int MOD = 1e9 + 7;
const double pi = acos(-1.0);
const int MAXN = 10000 + 10;
const int MAXT = 10000 + 10;
using namespace std;
vector<int> v;
int main(){
v.push_back(1);
v.push_back(2);
v.push_back(2);
v.push_back(1);
v.push_back(1);
int cur = 3;
while(1){
int cnt = v[cur];
int x;
if(v.size() & 1){
x = 2;
}
else{
x = 1;
}
for(int i = 0; i < cnt; ++i){
v.push_back(x);
}
if(v.size() > 10000000) break;
}
int T;
scanf("%d", &T);
while(T--){
int n;
scanf("%d", &n);
printf("%d\n", v[n - 1]);
}
return 0;
}

 

最新文章

  1. 《HelloGitHub月刊》第09期
  2. Js/Jquery获取iframe中的元素
  3. 使用echarts开发电子屏数据展示页面
  4. java 读写文件
  5. MYSQL操作数据表中的记录
  6. JS制作的简单的三级及联
  7. 十一、C# 泛型
  8. 高放的c++学习笔记之模板与泛型编程
  9. python-模块系列
  10. vmware 安装提示the msi failed
  11. web app 基础界面框架搭建
  12. P1577 切绳子
  13. HTTP权威指南_Note
  14. 关于SqlServer数据表操作
  15. hdu3530 双单调队列的维护
  16. scrapy 是指user_agent
  17. js input监听兼容事件
  18. 8-[表操作]--foreign key、表与表的关系
  19. CTF--zip伪加密
  20. 使用Dede破解Delphi软件实战

热门文章

  1. 从七牛服务下载PDF文件
  2. SELinux永久关闭
  3. IDEA工具java开发之 高级功能分屏是可以多次使用的 日志连接及浏览器 本地修改历 多列操作 查看方法调用情况
  4. 分析一次double强转float的翻车原因(转载)
  5. 十六 Spring的JDBC模版入门,默认连接池
  6. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 表单:静态控件
  7. JavaScript引用类型与对象
  8. ionic3记录之栅格布局使文字居中
  9. 线程context
  10. JS截取腾讯视频和去除视频广告