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 ...
随机推荐
- BZOJ 1511: [POI2006]OKR-Periods of Words
Description 求一个最长周期. Sol KMP. 一个点的最短周期就是 \(i-next[i]\) 此外 \(i-next[next[i]],i-next[next[next[i]]]\) ...
- BZOJ 4423: [AMPPZ2013]Bytehattan
Sol 对偶图+并查集. 思路非常好,将网格图转化成对偶图,在原图中删掉一条边,相当于在对偶图中连上一条边(其实就是网格的格点相互连边),每次加边用并查集维护就可以了. 哦对,还要注意边界就是网格外面 ...
- Apple WatchKit 初探
首先新建一个普通project即可. 然后添加WatchKit, file->new->target 直接NEXT后就能见到APPLE WATCH的编辑界面了. 因为apple watch ...
- mac 下搭建php 编程环境全过程
1,打开终端, 设置root密码sudo passwd root输入密码 2, 安装 apachemac 自带apache 启动apachectl start重新启动apachectl restart ...
- java.lang.ClassNotFoundException: net.sf.json.JSONArray,java.lang.NoClassDefFoundError: net/sf/json/JSONArray jetty跑项目遇到的问题
2016-05-18 15:44:25 ERROR Dispatcher.error[user:|url:]:L38 - Dispatcher initialization failed Unable ...
- ubuntu update dns server
edit: /etc/resolvconf/resolv.conf.d/base nameserver 114.114.114.114 execute this: $ resolvconf -u f ...
- POJ 1693
题意:就是给你n条直线,求这n条直线最多可以构成多少个矩形. 思路:把直线分类,分成水平的和竖直的,然后两两组合,看是否能构成矩形.枚举 Memory: 692K Time: 0MS Language ...
- FASTREPORT 整理 (mtm)
DELPHI中用FASTREPORT制作报表 1.加载并存储报表 默认情况下,报表窗体同项目窗体构存储在同一个DFM文件中.多数情况下,无须再操作,因而你就不必采用特殊方法加载报表. 如果你决定在文 ...
- java 入门 第二季2
(1). 封装 封装类的时候属性用private,方法getter和setter用public 将类的某些信息隐藏在类内部,不允许外部程序直接访问,而是通过该类提供的方法来实现对隐藏信息的操作和访问 ...
- 迷宫问题_BFS_挑战程序设计竞赛p34
给定一个N*M的迷宫,求从起点到终点的最小步数. N,M<100: 输入: 10 10#S######.#......#..#.#.##.##.#.#........##.##.####.... ...