博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SDNU 1543.Happy Salted Fish Every Day
阅读量:6525 次
发布时间:2019-06-24

本文共 1492 字,大约阅读时间需要 4 分钟。

Description

Salted fish Albert_s is a Sagittarius who will never grow up, especially in front of someone he like. Here's his self-portrait:

One day, he find a wonderful sequence: ……. This sequence consists of and , and its first term equals . Besides, if you see adjacent and equal terms as one group, you will get ……. Count number of terms in every group, you will get the sequence itself. Now, the sequence can be uniquely determined.

Forsaken and Wanderer attracted by this sequence, and they want to know what's the element. Because of something sadness, Albert_s is unable to think now. Would you like to help him?

Input

The first line contains a positive integer T(), denoting the number of test cases.
For each test case:
A single line contains a positive integer n(​).

Output

For each test case:
A single line contains a nonnegative integer, denoting the answer.

Sample Input

212

Sample Output

12
#include 
#include
#include
#include
#include
#include
using namespace std;#define ll long longint t, n, sequence[10000000+8], r, ii, j, a;void solve(){ sequence[1] = a = 1; sequence[2] = sequence[3] = 2; ii = 3; j = 4; while(j <= 10000000) { for(int i = 1; i <= sequence[ii]; i++) { sequence[j++] = a; } ii++; a = 3-a; }}int main(){ solve(); scanf("%d", &t);//我的想法 for(int i = 0; i

 

转载于:https://www.cnblogs.com/RootVount/p/10327703.html

你可能感兴趣的文章
JS组件系列——再推荐一款好用的bootstrap-select组件,亲测还不错
查看>>
getopt--parse command line options
查看>>
闭包和OC的block的本质
查看>>
MySQL出现Waiting for table metadata lock的场景浅析
查看>>
C# 语言历史版本特性(C# 1.0到C# 7.1汇总更新)
查看>>
什么是数据埋点?
查看>>
git回滚
查看>>
vue2.0 引用qrcode.js实现获取改变二维码的样式
查看>>
Python 判断闰年,判断日期是当前年的第几天
查看>>
web.xml 中的listener、 filter、servlet 加载顺序
查看>>
MyBatis原理简介和小试牛刀
查看>>
js部分基础
查看>>
脏读,幻读,不可重复读解释和例子
查看>>
Tomcat指定(JDK路径)JAVA_HOME而不用环境变量
查看>>
银行卡信息安全事件频发 互联网站成数据泄露"重灾区"
查看>>
云服务器 ECS 使用OpenAPI管理ECS:使用OpenAPI弹性创建ECS实例
查看>>
写个软件来防止服务器网站CPU百分百
查看>>
智能城市里,“公共电话亭”的存在意味着什么?
查看>>
JVM分代垃圾回收策略的基础概念
查看>>
5G技术的5大猜想
查看>>