以下是真坑爹题目:

此题必须输出前导零,否则永远a不了

I-number

Time Limit: 5000MS Memory limit: 65536K

题目描述

The I-number of x is defined to be an integer y, which satisfied the the conditions below:
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.

输入

 An integer T(T≤100) will exist
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.

输出

 Output the I-number of x for
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的更多相关文章

  1. JavaScript Math和Number对象

    目录 1. Math 对象:数学对象,提供对数据的数学计算.如:获取绝对值.向上取整等.无构造函数,无法被初始化,只提供静态属性和方法. 2. Number 对象 :Js中提供数字的对象.包含整数.浮 ...

  2. Harmonic Number(调和级数+欧拉常数)

    题意:求f(n)=1/1+1/2+1/3+1/4-1/n   (1 ≤ n ≤ 108).,精确到10-8    (原题在文末) 知识点:      调和级数(即f(n))至今没有一个完全正确的公式, ...

  3. Java 特定规则排序-LeetCode 179 Largest Number

    Given a list of non negative integers, arrange them such that they form the largest number. For exam ...

  4. Eclipse "Unable to install breakpoint due to missing line number attributes..."

    Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...

  5. 移除HTML5 input在type="number"时的上下小箭头

    /*移除HTML5 input在type="number"时的上下小箭头*/ input::-webkit-outer-spin-button, input::-webkit-in ...

  6. 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.免费应用程序调试最 ...

  7. 有理数的稠密性(The rational points are dense on the number axis.)

    每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.

  8. [LeetCode] Minimum Number of Arrows to Burst Balloons 最少数量的箭引爆气球

    There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided ...

  9. [LeetCode] Number of Boomerangs 回旋镖的数量

    Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of po ...

  10. [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 ...

随机推荐

  1. 补上题代码 hdu1520

    #include<iostream> #include<cmath> #include<algorithm> #include<vector> #inc ...

  2. 再谈Weiphp公众平台开发——1、增加插件

    去年开始接触基于Weiphp的公众平台开发,一直没时间好好整理一下. 下面开始讲解第一个自定义weiphp插件:MyHello的开发流程. 1.插件创建.在weiphp管理后台依次点击“插件管理-&g ...

  3. Extjs PROXY查询params无法传参,改用extraParams

  4. php中的钩子(hook插件机制)

    对"钩子"这个概念其实不熟悉,最近看到一个php框架中用到这种机制来扩展项目,所以大概来了解下. hook插件机制的基本思想: 在项目代码中,你认为要扩展(暂时不扩展)的地方放置一 ...

  5. VRRP虚拟路由器冗余协议

    VRRP(VirtualRouterRedundancyProtocol,虚拟路由冗余协议)是一种容错协议.通常,一个网络内的所有主机都设置一条缺省路由,这样,主机发出的目的地址不在本网段的报文将被通 ...

  6. C#析构函数与垃圾回收

    析构函数基本语法 C# class Car { ~ Car() // destructor { // cleanup statements... } } 析构函数说明 不能在结构中定义析构函数.只能对 ...

  7. 《Head First Servlet JSP》web服务器,容器,servlet的职责

    (一)web服务器,容器,servlet的职责 (二)J2EE服务器与web容器

  8. sizeof和strlen的区别

    一.sizeof    sizeof(...)是运算符,而不是一个函数.    sizeof操作符的结果类型是size_t,在头文件中typedef为unsigned int,其值在编译时即计算好了, ...

  9. 【leetcode】Search in Rotated Sorted Array II

    Search in Rotated Sorted Array II Follow up for "Search in Rotated Sorted Array":What if d ...

  10. ios UIWindow 错误使用导致无法接收motionEnded(摇一摇)函数

    今天遇到一个问题,第一次运行程序时,- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event函数无法调用,第二次就好了 ...