hdu--1013--Digital Roots(字符串)
Digital Roots
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 77503 Accepted Submission(s): 24224
For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yeilds 3, a single digit and also the digital root of 39.
/*
Name: hdu--1013--Digital Roots
Copyright: ©2017 日天大帝
Author: 日天大帝
Date: 22/04/17 10:34
Description: 这个题,就是特别坑
如果你一开始把所有的值设置为int型,恭喜你,你会得到一个WA
接着你大概会改成unsigned型,恭喜你,你会得到一个超时
然后你终于恍然大悟,用字符串!!
*/
#include<iostream>
#include<string>
using namespace std;
int main(){
ios::sync_with_stdio(false);
string str;
") {
;
;
){
int temp = sum;
sum = ;
while(temp){
sum += temp%;
temp /= ;
}
}
cout<<sum<<endl;
}
;
}
hdu--1013--Digital Roots(字符串)的更多相关文章
- 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(to_string的具体运用)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Othe ...
- 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(字符串,大数,九余数定理)
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- 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 Digital Roots 题解
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
- hdu 1013 Digital Roots
#include <stdio.h> int main(void) { int m,i;char n[10000]; while(scanf("%s",&n)= ...
- HDU OJ Digital Roots 题目1013
/*Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- HDU - 1310 - Digital Roots
先上题目: Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- 杭电 1013 Digital Roots
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1013 反思:思路很简单,但是注意各位数加起来等于10的情况以及输入0的时候结束程序该怎么去表达 #in ...
随机推荐
- unity3d项目导入android studio
第一步 拿到unity3d项目,里面包含以下文件 第二步 在android studio下新建一个project 第三步 将unity3d项目目录下的libs下的jar文件复制黏贴到android s ...
- solr 搜索引擎查询
搜索引擎查询的时候://对于这些filterQuery的字段,必须是indexed="true",如果之前有这个字段后来改这个indexed属性,则需要重新建立索引,否则搜索不到S ...
- 将百度坐标转换的javascript api官方示例改写成传统的回调函数形式
改写前: 百度地图中坐标转换的JavaScript API示例官方示例如下: var points = [new BMap.Point(116.3786889372559,39.90762965106 ...
- awvs 中文手册详细版
目录: 0×00.什么是Acunetix Web Vulnarability Scanner ( What is AWVS?) 0×01.AWVS安装过程.主要文件介绍.界面简介.主要操作区域简介(I ...
- APP测试点归纳
1.2测试周期 测试周期可按项目的开发周期来确定测试时间,一般测试时间为两三周(即 15个工作日), 根据项目情况以及版本质量可适当缩短或延长测试时间.正式测试前先向主管确认项目排期. 1.3测试资源 ...
- (转载)Bonding技术指南
原文链接:http://www.wushiqin.com/?post=68 一.什么是网卡绑定及简单原理 网卡绑定也称作"网卡捆绑",就是使用多块物理网卡虚拟成为一块网卡,以提供负 ...
- 【hibernate 初探】之 关系映射,ORM
从整理上讲,一个ORM框架(以hibernate为例)所涉及内容无非就是,如何映射,如何检索,还有事务处理.所以从这三方面入手,基本上可以保证将hibernate可以用到自己的项目之中.所以我先说一下 ...
- JAVA - 工厂模式
1. 简单工厂违背OCP(Open Close Principle)原则 , 即对增加开放,对修改关闭.如果要符合OCP原则,要针对接口编程. //简单工厂模式,违反了OCP原则 public cla ...
- Django学习(四)---Admin配置
1)Admin: admin是django自带的功能强大的自动化数据管理界面 被授权的用户可以直接在Admin中管理数据库(增.删.改.查) Django提供了许多针对Admin的定制功能 2)配置A ...
- Entity Framework Core 命名约定
本文翻译自<Entity Framework Core: Naming Convention>,由于水平有限,故无法保证翻译完全正确,欢迎指出错误.谢谢! 注意:我使用的是 Entity ...