HDU - 1013
wa了两遍:
(1)没有弄清楚输入数据的范围,实际上是字符串输入,数字很大。
(2)此题太水,没有标数据范围。
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring> #define ll long long
using namespace std;
#define maxn 1000000000
char s[maxn]; int main()
{
while(~scanf("%s",s))
{
if(s[]=='')
break;
ll sum=;
ll len=strlen(s); //(1)
for(int i=; i<len; i++)
{
sum+=s[i]-'';
} ll tmp=sum;
while(sum>=)
{
sum=;
while(tmp)
{
sum+=tmp%;
tmp/=; }
tmp=sum;
}
cout<<sum<<endl;
}
return ;
}
HDU - 1013的更多相关文章
- HDU 1013 Digital Roots【字符串,水】
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 1013 Digital Roots(to_string的具体运用)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Othe ...
- hdu 1013 Digital Roots
#include <stdio.h> int main(void) { int m,i;char n[10000]; while(scanf("%s",&n)= ...
- HDU 1013 Digital Roots(字符串)
Digital Roots Problem Description The digital root of a positive integer is found by summing the dig ...
- HDU 1013.Digital Roots【模拟或数论】【8月16】
Digital Roots Problem Description The digital root of a positive integer is found by summing the dig ...
- hdu 1013 过山车 匈牙利算法(代码+详细注释)
过山车 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- HDU 1013 Digital Roots(字符串,大数,九余数定理)
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 1013 Digital Roots 题解
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
随机推荐
- 聊聊基准测试的MVP方案
上篇博客介绍了基准测试的一些思路和方法策略,这篇博客,聊聊基准测试的MVP(最小可行性方案)... 思维导图 一.测试策略 策略名称 阈值 运行时间 性能指标 基线 注释 并发测试 CPU75%+Er ...
- MyExceptionFilter 异常注入
public class MyExceptionFilter : IExceptionFilter { private ILogService logService; public MyExcepti ...
- 如何用ABP框架快速完成项目(6) - 用ABP一个人快速完成项目(2) - 使用多个成熟控件框架
正如我在<office365的开发者训练营,免费,在微软广州举办>课程里面所讲的, 站在巨人的肩膀上的其中一项就是, 尽量使用别人成熟的框架. 其中也包括了控件框架 abp和52abp ...
- MySQL备份恢复-mysqldump原理
+++++++++++++++++++++++++++++++++++++++++++标题:mysqldump对MySQL数据库备份恢复原理时间:2019年2月23日内容:mysqldump工具重点: ...
- Jquery2--属性相关的操作
知识点总结 1.属性 属性(如果你的选择器选出了多个对象,那么默认只会返回出第一个属性). attr(属性名|属性值) - 一个参数是获取属性的值,两个参数是设置属性值 - 点击加载图片示例 remo ...
- CodeForces 1151B Dima and a Bad XOR
题目链接:http://codeforces.com/contest/1151/problem/B 题目大意: 给定一个n*m的矩阵,里面存放的是自然数,要求在每一行中选一个数,把他们异或起来后结果大 ...
- Linux下开启和关闭Telnet服务
telnet与ssh相比,安全性能并不高,但是在SSH版本升级或者其他的情况下还是需要开启这一服务. linux提供服务是由运行在后台的守护程序(daemon)来执行的,telnet服务是由xinet ...
- Django初印象之视图(view)
一.view的初印象 一个视图函数(类),简称视图.我们发起web请求时,返回的web响应.[大家约定成俗将视图放置在项目(project)或应用程序(app)目录中的名为views.py的文件中.] ...
- 计算pi的位数
from random import random from math import sqrt from time import clock DARTS=1000000 hits=0.0 clock( ...
- ASP.NET知识点汇总
一 ,html属性20181113常用的居中方法1 text-align2 float3 margin (margin-left matgin-right margin-bottom margin-t ...