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 ...
随机推荐
- [转]MySQL主从复制入门
1.MySQL主从复制入门 首先,我们看一个图: 影响MySQL-A数据库的操作,在数据库执行后,都会写入本地的日志系统A中. 假设,实时的将变化了的日志系统中的数据库事件操作,在MYSQL-A的33 ...
- C#之常见数组编码错误
摘抄自C#本质论(第四版,P55) 常见错误 错误描述 改正后的代码 int numbers[] 用于声明数组的方括号放在数据类型之后,而不是在变量标识符之后 int[] numbers; int[] ...
- ios awakeFromNib 和 initWithCoder:
During the instantiation process, each object in the archive is unarchived and then initialized with ...
- ACM/ICPC 之 四道MST-Prim解法(POJ1258-POJ1751-POJ2349-POJ3026)
四道MST,适合Prim解法,也可以作为MST练习题. 题意包括在代码中. POJ1258-Agri Net 水题 //Prim-没什么好说的 //接受一个邻接矩阵,求MST //Time:0Ms M ...
- web.config中配置页面出错后跳转指定错误页面
每当用户访问错误页面时,会出现不友好的404错误,所以为了防止这种不友好,我们在web.config中的<system.web>节点下配置 <customErrors>,在出现 ...
- 从下拉菜单拖拽一个元素 出来,插入到页面中的app 列表中
1,实现功能:从下拉菜单拖拽一个元素 出来,插入到页面中的app 列表中 并实现app向后移动一个元素的位置: 2.实现思路: 01.遍历下拉菜单,添加拖拽方法,实现位置移动功能: 02.遍历app列 ...
- 【leetcode】 search Insert Position(middle)
Given a sorted array and a target value, return the index if the target is found. If not, return the ...
- xcode报错,svn : is not a workingCopy
解决方案: 1.点击对应的targets 2.选择build phases 3.在红框处有一个run script选项(截图中已经删除了.),点击下拉按钮,看看是否是与svn有关的东西, 如果是,删除 ...
- ASIHTTPRequest详解 [经典3]
大文件断点续传 0.94 以后支持大文件的断点下载,只需要设置: [ request setAllowResumeForFileDownloads:YES ]; [ request setDownlo ...
- T4模板
T4,即4个T开头的英文字母组合:Text Template Transformation Toolkit. T4文本模板,即一种自定义规则的代码生成器.根据业务模型可生成任何形式的文本文件或供程序调 ...