[水]ZOJ1115
来源:互联网 发布:淘宝修改主营类目 编辑:程序博客网 时间:2024/05/06 09:47
没给数据范围就乱搞了,看到WA了以后换了long long 又是WA【不返回re真是赞】
顺手试试assert好了
assert(n<=0)可以看是否爆了上限= =
#include <bits/stdc++.h>using namespace std;char a[500000];int GaoGao(int i){ int ret=0; while (i>=10) { int tem=0; while (i!=0) { tem+=i%10; i/=10; } i=tem; } cout<<i<<endl;}void Gao(){ int tem=0; for (int i=0;i<strlen(a);i++) { // assert(tem<=100000000000000); tem+=a[i]-'0'; } if (tem==0) return ; GaoGao(tem);}int main(){ //freopen("a.in","r",stdin); while (scanf("%s",a)!=EOF) Gao(); return 0;}
0 0
- [水]ZOJ1115
- ZOJ1115
- zoj1115
- ZOJ1115
- zoj1115
- zoj1115
- zoj1115
- ZOJ1115解题
- zoj1115-----------Digital Roots
- zoj1115-Digital Roots
- Zoj1115(易错)
- Python--ZOJ1115 and ZOJ1151
- zoj1115 Digital Roots
- 水
- 水
- 水
- 水
- 水
- win7 下 IIS的配置问题
- HDU1863:畅通工程(kruskal)
- 三 极 管 分 压 式 偏 置
- poj1064 Cable master(二分求解)
- linux常用命令
- [水]ZOJ1115
- ArcGIS教程:捕捉倾泻点
- git永久删除文件
- 成败论输赢的“淘宝客”网站
- web.xml文件的作用
- jQuery jcrop插件截图使用方法
- hdu 1078 FatMouse and Cheese (dfs+记忆化搜索)
- OC 初步认识
- curl_exec和wget执行太慢,IPv6惹的祸