Hangzhou Electric 4608 (I-number) Java write very easy is super memory!!!

Source: Internet
Author: User

Do not use Java in the large number of templates do see Hdu1002,java write is very easy is super memory!!!

Problem DescriptionThe I-number of x is defined to being an integer y, which satisfied the the conditions below:
1.y>x;
2.The sum of each digit of Y (under base) is the multiple of 10;
3.Among all integers this satisfy the conditions above, y shouble be the minimum.
Given x, you ' re required to calculate the I-number of X.
Inputan integer T (t≤100) would exist in the first line of input, indicating the number of test cases.
The following T lines describe all the queries and each with a positive integer x. The length of x would not exceed 105.

Outputoutput the I-number of x for each query.
Sample Input
1202

Sample Output
208

Implementation code

Import Java.util.*;import java.math.*;class main{public    static void Main (string[] args) {    final BigInteger p= Biginteger.one;        Scanner sc=new Scanner (system.in);        int T=sc.nextint ();        while (t-->0) {            int sum;            BigInteger X=sc.nextbiginteger ();            while (true) {            x=x.add (P);            String str=x.tostring ();                sum=0;                for (int i=0;i<str.length (); i++) {                    Sum+=str.charat (i)-' 0 ';                }                if (sum%10==0) {                    System.out.println (x);                    Break;}}}}    




Hangzhou Electric 4608 (I-number) Java write very easy is super memory!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.