import java.util.Scanner; import java.math.BigInteger; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); BigInteger a,b; String[] s; while(in.hasNextLine()){ s = in.nextLine().split("\\s+"); //正则表达式,\\s+ 表示一个或多个空白字符 a = new BigInteger(s[0]); b = new BigInteger(s[2]); if(s[1].equals("%")) System.out.println(a.mod(b)); if(s[1].equals("/")) System.out.println(a.divide(b)); } } }
时间: 2024-10-09 23:34:55