标签:str -o 操作 imp int ati next rgs try
输入为一行,包含两个字符串,字符串的长度在[1,100]。
输出为一行。合法情况输出相加结果,非法情况输出error
123 123 abd 123
246 Error
import java.math.BigInteger; import java.util.HashSet; import java.util.Hashtable; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); try { BigInteger sBigInteger=scanner.nextBigInteger(); BigInteger sBigInteger2=scanner.nextBigInteger(); System.out.println(sBigInteger.add(sBigInteger2)); } catch (Exception e) { System.out.println("error"); } } }
标签:str -o 操作 imp int ati next rgs try
原文地址:https://www.cnblogs.com/jinxingerhuo/p/9734625.html