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 ...
随机推荐
- 我用Python实现了一个小说网站雏形
前言 前段时间做了一个爬取妹子套图的小功能,小伙伴们似乎很有兴趣,为了还特意组建了一个Python兴趣学习小组,来一起学习.十个python九个爬,在大家的印象中好像Python只能做爬虫.然而并非如 ...
- redis--小白博客
概述 redis是一种nosql数据库,他的数据是保存在内存中,同时redis可以定时把内存数据同步到磁盘,即可以将数据持久化,并且他比memcached支持更多的数据结构(string,list列表 ...
- virtualbox 设置centos7 双网卡上网
上次用virtualbox安装centos6.6,这次装了一个centos7.0.用两个版本的配置还是大同小异的. 1.修改/etc/sysconfig/network-scripts/ifcfg-e ...
- [Alpha阶段]第二次Scrum Meeting
Scrum Meeting博客目录 [Alpha阶段]第二次Scrum Meeting 基本信息 名称 时间 地点 时长 第二次Scrum Meeting 19/04/04 大运村寝室6楼 90min ...
- MD 的常用语法格式
参考资料:MarkDown 语言常用语法 注意:vscode 中,可以使用 ctrl + shift + v 进行预览: 一.标题 一般使用 # 来进行层级标识.共 6 个层级,再多不识别. # = ...
- [模板] 笛卡尔树 && RMQ
话说我noip之前为什么要学这种东西... 简介 笛卡尔树(Cartesian Tree) 是一种二叉树, 且同时具有以下两种性质: 父亲节点的值大于/小于子节点的值; 中序遍历的结果为原序列. 笛卡 ...
- vue1.0+vue2.0实现选项卡
通常我们写tab选项卡的时候,一般都是用jq等去操作dom,给同级元素移除active类,然后,给被点击元素添加active类,用vue实现也是同样的原理,都是操作active类. 我们都知道用vue ...
- Python 面向对象高阶-----metaclass
Python 面向对象高阶-----metaclass 前言 类也是对象,既然类是对象,那就自然是某个东西的实例化,这个东西就是type 首先看下type是怎么回事 type type最常用的方法就是 ...
- HDOJ5543 Pick The Sticks
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5543 题目大意:有n个金条,每个金条有长度和价值,给一个长度为L的容器,当金条在容器两端的时候,只要重 ...
- jmeter5.1测试dubbo接口
dubbo接口功能介绍 客户端输入uncleyong(当然,也可以是其他字符串),服务端返回hello uncleyong 开发dubbo服务jmeter客户端 idea中创建模块dubbo_jmet ...