做了A+B Problem,A/B Problem不是什么问题了吧!
110 / 100 99 % 10 2147483647 / 2147483647 2147483646 % 2147483647
1 9 1 2147483646
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); while(input.hasNext()){ String a=input.next(); String c=input.next(); String b=input.next(); BigInteger A=new BigInteger(a); BigInteger B=new BigInteger(b); if(c.equals("/")){ System.out.println(A.divide(B)); }else{ System.out.println(A.mod(B)); } } } }
A/B Problem_ny_803(大数).java,布布扣,bubuko.com
原文:http://blog.csdn.net/zhangyiacm/article/details/21118493