UVA

用java写的大数基本操作,java要求的格式比较严谨。

 1 import java.util.*;
 2 import java.math.*;
 3 public class Main {
 4         public static void main(String args[]) {
 5             Scanner cin = new Scanner(System.in);
 6             
 7             BigInteger a,b,ans;
 8             String c;
 9             b = BigInteger.valueOf(1);
10             a = BigInteger.valueOf(1);
11         //    BigInteger zero=new BigInteger("0");
12             
13             while(cin.hasNext())
14             {
15                 a=cin.nextBigInteger();
16                 c=cin.next();
17                 b=cin.nextBigInteger();
18                 if(c.equals("/"))
19                     ans = a.divide(b);
20                 else
21                     ans=a.mod(b);
22                 System.out.println(ans);
23             }
24             return ;
25     }
26     
27 }
View Code

还有一些关于java的基本操作,参见大佬博客:https://blog.csdn.net/Akatsuki__Itachi/article/details/81152232

原文地址:https://www.cnblogs.com/daybreaking/p/9381362.html