uva 10494 If We Were a Child Again

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));
        }
    }
}

 

posted @ 2015-07-17 22:13  杨永华  阅读(143)  评论(0编辑  收藏  举报