1013 Realtime Status
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 77880 Accepted Submission(s): 24325
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.
39
0
3
#include<stdio.h>
int main()
{
long long int t;
scanf("%lld",&t);
while(t)
{
printf("%d\n",(t-)%+);
scanf("%lld",&t);
}
return ;
}
第一次的代码,没有考虑数字很大很大的情况下,所以一直是WA
下面使用字符串改进的代码,AC了
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{
string s;
while()
{
int m=;
cin>>s;
if(s[]-''==&&s.length()==)
break;
for(int i=;i<s.length();i++)
{
m+=s[i]-'';
}
cout<<(m-)%+<<endl;
}
}
1013 Realtime Status的更多相关文章
- [PHP]swoole_server几个进程的分工
readme.md-/Users/zjh/Documents/我的文章/[PHP]swoole_server几个进程的分工 html{font-family: sans-serif;-ms-text- ...
- [PHP]Yii2框架的坑
[PHP]Yii2框架的坑.md-/Users/zjh/Documents/我的文章/[PHP]Yii2框架的坑 html{font-family: sans-serif;-ms-text-size- ...
- [PHP]程序员技能栈
[PHP]程序员技能栈.md-/Users/zjh/Documents/我的文章/[PHP]程序员技能栈 html{font-family: sans-serif;-ms-text-size-adju ...
- Color国际青年公寓
Color国际青年公寓介绍.md-/Users/zjh/Documents html{font-family: sans-serif;-ms-text-size-adjust: 100%;-webki ...
- EXPDP IMPDP 知识总结
Data Pump Export ATTACH Default: job currently in the user's schema, if there is only one Purpose(目的 ...
- 转贴---Performance Counter(包含最全的Windows计数器解释)
http://support.smartbear.com/viewarticle/55773/ 这个Article中介绍了一个新工具,TestComplete,把其中涉及到性能计数器的部分摘抄出来了. ...
- Delphi 7生成XML
文件格式为: Day 制1課 U12 ASSY01 Wrist 1009 0 2018/05/18 09:35:59 Day 制1課 U12 ASSY02 Wrist 1010 0 2018/05/1 ...
- Digital Twin 数字孪生
GE的一个NB视频:http://v.youku.com/v_show/id_XMjk0NTMzODIyNA==.html http://www.gongkong.com/news/201701/35 ...
- Real-Time SQL Monitoring
Real-Time SQL Monitoring可以在sql运行的时候监控其性能. 缺省情况下,单个sql执行花费的CPU或I/O时间超过5秒或sql并行执行的时候,Real-Time SQL Mon ...
随机推荐
- java学习笔记 --- 面向对象2
一.匿名对象 (1)没有名字的对象 (2)应用场景 A:调用方法,仅仅只调用一次的时候. class Car { //描述属性.颜色,轮胎数. String color; int number; ...
- 知问前端——html+jq+jq_ui+ajax
**************************************************************************************************** ...
- C#中如何给PDF添加可见的数字签名
数字签名广泛用于保护PDF文档,可见数字签名在日常生活中是相当重要的.在这篇文章中我将与大家分享如何给PDF文件添加可见的数字签名. 首先我下载了一个由E-iceblue公司开发的免费版的PDF组件- ...
- 浏览器访问php脚本通过sendmail用mail函数发送邮件
前几天做项目遇到这样的一个问题:当某一个结点下有新的文章发表的时候,以邮件的形式通知该结点下的所有用户.这就需要用到邮件发送的功能. 因为项目是php语言做的,所以最简单的方法就是使用php自带的函数 ...
- MySQL存储过程--带参数报错1064
DELIMITER $$ USE `student`$$ DROP PROCEDURE IF EXISTS `sync_student`$$ CREATE DEFINER=`student`@`%` ...
- python 实例方法,类方法和静态方法
在学习python代码时,看到有的类的方法中第一参数是cls,有的是self,经过了解得知,python并没有对类中方法的第一个参数名字做限制,可以是self,也可以是cls,不过根据人们的惯用用法, ...
- Spring Boot 学习笔记--整合Thymeleaf
1.新建Spring Boot项目 添加spring-boot-starter-thymeleaf依赖 <dependency> <groupId>org.springfram ...
- PAT 1047
1049. Counting Ones (30) The task is simple: given any positive integer N, you are supposed to count ...
- 如何选择适合自己的CMS建站系统
在互联网发展突飞猛进的今天,可谓”得市场者得天下”,而电商已成为占据市场速度最快.范围最广的手段,进而网站建设也逐渐引起商家重视,并深入到了企业和个体的发展战略之中. 如今企业建站已 ...
- oracle实现like多关键字查询
oracle实现like多关键字查询: select * from contract_info tt where 1=1 and REGEXP_LIKE(tt.contract_name,'关键字1| ...