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 ...
随机推荐
- am335x UART1输入u-boot 调试信息代码修改
AM335x 调试信息UART1输出代码修改1. 关于pin_mux 的配置代码修改位置:/board/forlinx/ok335x/mux.c void enable_uart0_pin_mux( ...
- 5.8---像素设定(CC150)
注意:仔细注意位置. public static int[] renderPixel(int[] screen, int x, int y){ int[] ans = new int[screen.l ...
- python md5加密中文
import md5 md5.new(u'中文').hexdigest() 会失败,报告ascii码不能解码0x.... 原因是md5会自动将被加密的数据转成字节码,如果没有详细制定编码,则可能采用了 ...
- 【转】【编码】ASCII 、UNICODE和UTF-8之二
字符发展 1. 美国 ASCII-(American standard code information interchange) 美国信息互换标准代码 范围:1-127 ; 单字 备注:前部用作控制 ...
- Python操作PDF与Tiff文件
1.PDF文件的合并与拆分 pypdf http://www.douban.com/note/455252403/ http://www.redicecn.com/html/Python/201301 ...
- Appium+Robotframework实现Android应用的自动化测试-6:一个简单的例子
万事具备,只欠编码! 下面看一个简单的示例,这个示例验证Android手机自带的通讯录的添加联系人的操作是否成功.这个例子是Appium官网自带的示例,有兴趣的同学也可以自己下载来研究和学习,下载地址 ...
- ios iphone6 Plus 的适配问题
最近更新一个老程序,发现在iphone6 plus上用nslog打印出的screen 的frame还是320*568, 不是414*736, 查了一下,原来需要设置iphone6 plus的启动画面才 ...
- 7.js模式-装饰者模式
1. 装饰者模式 给对象动态增加职责的方式称为装饰者模式. Function.prototype.before = function(beforefn){ var _self = this; retu ...
- Java for LeetCode 232 Implement Queue using Stacks
Stack<Integer> stack=new Stack<Integer>(); public void push(int x) { stack.push(x); } // ...
- MPAndroidChart 教程
以前没用过MPAndroidChart,为了方便学习查找,引用下别个大神的笔记. 其余文章索引: MPAndroidChart 教程:概述MPAndroidChart 教程:开始 Getting St ...