HDU-1047 Integer Inquiry 大数相加
2013-10-27 15:03
387 查看
第一道java AC代码 =。=
import java.io.*; import java.util.*; import java.text.*; import java.math.*; public class Main { public static void main(String args[]) { int t; Scanner scan = new Scanner( System.in ); t = scan.nextInt(); BigInteger ans = BigInteger.ZERO,a; while( (t--)>0 ) { ans = BigInteger.ZERO; while( true ) { a = scan.nextBigInteger(); if( a.compareTo(BigInteger.ZERO) == 0 ) break; ans = ans.add(a); } System.out.println(ans); if( t > 0 ) System.out.println(""); } } }
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while(scanner.hasNext()) { String s1 = scanner.next(); String s2 = scanner.next(); BigInteger num1 = new BigInteger(s1); BigInteger num2 = new BigInteger(s2); System.out.println(num1.add(num2)); } } }
相关文章推荐
- HDU 1047 Integer Inquiry 大数相加 string解法
- HDU 1047 Integer Inquiry 大数相加 string解法
- HDU 1047 Integer Inquiry 多个大数相加
- HDU 1047 Integer Inquiry (多个大数相加)
- HDOJ 1047 Integer Inquiry(多个大数相加)
- hdu 1047 Integer Inquiry(大数加)
- HDU 1047 Integer Inquiry【大数】
- hdoj 1047 Integer Inquiry 【多个大数相加】
- HDU 1047 Integer Inquiry JAVA大数
- hdu 1047 Integer Inquiry(大数)
- hdu 1047 Integer Inquiry 大数加法
- HDU1047 - Integer Inquiry (大数加法)
- 杭电—1047 多个大数相加 Integer Inquiry
- Integer Inquiry_hdu_1047(大数).java
- HDU - 1047 - Integer Inquiry (大数高精度)
- HDU-1047-Integer Inquiry(Java大数水题 && 格式恶心)
- BigNums——HDUOJ 1047 - Integer Inquiry(多个大数相加)
- hdu acm-1047 Integer Inquiry(大数相加)
- HDU-1047-Integer Inquiry(Java大数水题 && 格式恶心)
- hdu 1047 Integer Inquiry