现在的位置: 首页 > 综合 > 正文

hdu 1002 A + B Problem II

2019年02月20日 ⁄ 综合 ⁄ 共 377字 ⁄ 字号 评论关闭

贴份大数加法模板0 0

import java.util.*;
import java.math.*;

public class Main{
    public static void main(String s[])
    {
        Scanner sc = new Scanner( System.in );
        BigInteger a, b;
        int t = sc.nextInt();
        for( int i = 1; i <= t; ++i )
        {
            System.out.println( "Case " + i + ":");
            a = sc.nextBigInteger();
            b = sc.nextBigInteger();
            if( i < t )
            {
                System.out.println( a + " + " + b + " = " + a.add(b) );
                System.out.println( );
            }
            else
            {
                System.out.println( a + " + " + b + " = " + a.add(b) );
            }
        }
    }
}

抱歉!评论已关闭.