ZOJ1633-构造模拟-Big String
来源:互联网 发布:中国象棋网络高手 编辑:程序博客网 时间:2024/06/08 17:11
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1633
第一个a串是 “^__^”;
第二个b串是 “T.T”
第三个c是 2+1串,(b串在前)
c变成b
b变成a
继续相加,问你最后长度很长的串。
第n为是几。
我们发现串的长度是有限制的。当小于7时可以判断。
而不小于7,我们可以逆推回去。
根据长度的关系。
注意范围。
#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cmath>using namespace std;const int maxn=103;int main(){ long long a[maxn]; a[0]=4; a[1]=3; string s="T.T^__^"; for(int i=2;i<=94;i++) //if(a[i]<1e18) a[i]=a[i-1]+a[i-2]; long long m; while(~scanf("%lld",&m)){ { while(m>7) { int c=lower_bound(a,a+89,m)-a; m=m-a[c-1]; } printf("%c\n",s[m-1]); } } return 0;}
阅读全文
0 0
- ZOJ1633-构造模拟-Big String
- zoj1633 Big String dfs
- ZOJ 1633 Big String(模拟构造)
- string 模拟之-big three
- Big String
- hdu5414 CRB and String(构造,模拟)
- Big Number+模拟数取模
- codeforces 709D Recover the String (构造+模拟)
- 贪心,模拟,构造(HDU 5414,CRB and String)
- String的Big-Three
- zoj 1633 Big String
- B - Big String
- poj 2887 Big String
- POJ 2887 Big String
- poj 2887 Big String
- ZOJ - 1633 Big String
- poj 2887 Big String
- UVa 10970 Big Chocolate (模拟)
- php魔术方法(三)类的序列化和反序列化
- 并发基础_4_并发_线程间通信
- 开启博客技术之路
- Java实现添加压缩文件
- MySql-Limit用法
- ZOJ1633-构造模拟-Big String
- Http协议通信
- Python中的yield
- verilog时钟分频设计(整合模块)
- 利用QT编写一个简单爬虫程序
- Linux进程全解3——进程概念、进程ID、多进程调度原理
- Windows10 远程桌面控制 ubuntu 15.1.0
- Spring MVC中Controller如何将数据返回给页面
- JAVA学习日记---Thinking in Java学习笔记,6章总结