HDU 1002 A+B Problem II 大数相加
发布时间:2020-12-14 04:01:16 所属栏目:大数据 来源:网络整理
导读:java里的BigInteger。。还是很好用的 import java.io.*;import java.util.*;import java.math.*;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader cin = new BufferedReader( new InputStreamReader(System.i
java里的BigInteger。。还是很好用的 import java.io.*; import java.util.*; import java.math.*; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader cin = new BufferedReader( new InputStreamReader(System.in) ); PrintWriter pw = new PrintWriter( new OutputStreamWriter(System.out) ); String s; while( (s=cin.readLine())!=null ){ int n = Integer.parseInt(s); for(int i=1;i<=n;i++) { s = cin.readLine(); String t[] = s.split(" "); BigInteger ai = new BigInteger(t[0]); BigInteger bi = new BigInteger(t[1]); pw.println("Case "+i+":"); pw.println(t[0]+" + "+t[1]+" = "+ai.add(bi)); if(i!=n) pw.println(); } pw.flush(); } cin.close(); pw.close(); } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |