Hdu-1002(高精度加法_java)

来源:互联网 发布:机动战士z高达评价知乎 编辑:程序博客网 时间:2024/05/16 05:39

PE了两次,

很久不做hdu上面的题目了,都不知道了,他还有这么一个坑人的地方了...

郁闷了都

贴出代码:

import java.util.Scanner;import java.math.BigInteger;public class Main {public static void main (String[] args) {Scanner input = new Scanner(System.in);    int N;    N = input.nextInt();    for (int i = 1; i <= N; i++)    {    BigInteger a = input.nextBigInteger();    BigInteger b = input.nextBigInteger();    System.out.println ("Case " + i + ":");    System.out.print (a + " + " + b + " = ");    System.out.println (a.add(b));    if (i != N)    {    System.out.println ();    }    }    }}


原创粉丝点击