I-number
以下是真坑爹题目:
此题必须输出前导零,否则永远a不了
I-number
Time Limit: 5000MS Memory limit: 65536K
题目描述
1. y>x;
2. the sum of each
digit of y(under base 10) is the multiple of 10;
3. among all integers that satisfy the two conditions
above, y shouble be the minimum.
Given x, you\'re required to calculate the I-number of
x.
输入
in the first line of input, indicating the number of test cases.
The following T lines
describe all the queries, each with a positive integer x. The length of x will
not exceed 105.
输出
each query.
示例输入
1
202
示例输出
208
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int f[];
int main()
{
int n;
scanf("%d",&n);
{
int i,j;
int ts=;
for(ts=; ts<=n; ts++)
{
memset(f,,sizeof(f));
char g[];
scanf("%s",g);
int t=strlen(g);
for(i=,j=t-; g[i]!='\0'; i++,j--)
f[j]=g[i]-'';
int sum;
while()
{
sum=;
f[]=f[]+;
for(i=; i<=t-;i++)
{
if(f[i]>=)
{
f[i]=f[i]%;
f[i+]=f[i+]+;
}
else break;
}
if(f[t]>)t++;
for(i=;i<=t-;i++)
sum=sum+f[i];
if(sum%==)
{
for(i=t-;i>=;i--)
printf("%d",f[i]);
printf("\n");
break;
}
}
}
}
return ;
}
I-number的更多相关文章
- JavaScript Math和Number对象
目录 1. Math 对象:数学对象,提供对数据的数学计算.如:获取绝对值.向上取整等.无构造函数,无法被初始化,只提供静态属性和方法. 2. Number 对象 :Js中提供数字的对象.包含整数.浮 ...
- Harmonic Number(调和级数+欧拉常数)
题意:求f(n)=1/1+1/2+1/3+1/4-1/n (1 ≤ n ≤ 108).,精确到10-8 (原题在文末) 知识点: 调和级数(即f(n))至今没有一个完全正确的公式, ...
- Java 特定规则排序-LeetCode 179 Largest Number
Given a list of non negative integers, arrange them such that they form the largest number. For exam ...
- Eclipse "Unable to install breakpoint due to missing line number attributes..."
Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...
- 移除HTML5 input在type="number"时的上下小箭头
/*移除HTML5 input在type="number"时的上下小箭头*/ input::-webkit-outer-spin-button, input::-webkit-in ...
- iOS---The maximum number of apps for free development profiles has been reached.
真机调试免费App ID出现的问题The maximum number of apps for free development profiles has been reached.免费应用程序调试最 ...
- 有理数的稠密性(The rational points are dense on the number axis.)
每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.
- [LeetCode] Minimum Number of Arrows to Burst Balloons 最少数量的箭引爆气球
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided ...
- [LeetCode] Number of Boomerangs 回旋镖的数量
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of po ...
- [LeetCode] Number of Segments in a String 字符串中的分段数量
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of ...
随机推荐
- C# 属性和索引
//用索引取一个记录中的各项 using system; class IndexerRecord{ private string[] data= new string [6]; private str ...
- nc 局域网聊天+文件传输(netcat)
nc 局域网聊天+文件传输 nc的全程是netcat,这个工具非常好用. 有时候我们需要在局域网内传送一些文本消息或者文件的时候,通常的做法是安装一些局域网通讯软件,然后来做.其实不必要这样,使用nc ...
- 17 任务调度相关类综述——Live555源码阅读(一)任务调度相关类
这是Live555源码阅读的第二部分,包括了任务调度相关的三个类.任务调度是Live555源码中很重要的部分. 本文由乌合之众 lym瞎编,欢迎转载 http://www.cnblogs.com/ol ...
- windows安装rsync
客户端:cwRsync 4.0.5 Installer 服务端:cwRsyncServer 4.0.5 Installer 安装配置Rsync服务端 1.直接双击安装包安装即可,在安装过程中会有要求用 ...
- java中类名,方法,变量,包名等大小写命名规范
类名:首字母大写,其他单词中首字母大写,其他小写方法名:首字母小写,其他单词中首字母大写,其他小写变量:与方法名规则同包名:全部小写接口interface:I开头
- 解决vi/vim中粘贴会在行首多很多缩进和空格的问题
解决vi/vim中粘贴会在行首多很多缩进和空格的问题 secureCRT会将你原来的文本原封不动的按照字符串的样式发送给服务器.所以当你的服务器上的vim设置为autoindent的话,在i模式下,那 ...
- Angularjs与bootstrap.datetimepicker结合实现日期选择器
http://www.lovelucy.info/angularjs-best-practices.html http://damoqiongqiu.iteye.com/blog/1917971 ht ...
- Rubix - ReactJS Powered Admin Template 后台管理框架
Rubix - ReactJS Powered Admin Template 后台管理框架,使用 ReactJS. http://rubix400.sketchpixy.com/ltr/charts ...
- ACM/ICPC 之 树形DP(POJ1192)
将某点看做根状态,邻接点看做子状态,由子状态向根状态转移. POJ1192-最优连通子集 题解:将每一个点分成两个状态进行保存,因此可以构造一个数组dp[i][2]. dp[i][0]:不包括该点权值 ...
- ACM/ICPC 之 用双向链表 or 模拟栈 解“栈混洗”问题-火车调度(TSH OJ - Train)
本篇用双向链表和模拟栈混洗过程两种解答方式具体解答“栈混洗”的应用问题 有关栈混洗的定义和解释在此篇:手记-栈与队列相关 列车调度(Train) 描述 某列车调度站的铁道联接结构如Figure 1所示 ...