码迷,mamicode.com
首页 > 其他好文 > 详细

UVA - 10494 If We Were a Child Again

时间:2018-07-28 13:36:22      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:bsp   lse   turn   []   ext   ide   can   new   技术分享   

技术分享图片

 

用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

UVA - 10494 If We Were a Child Again

标签:bsp   lse   turn   []   ext   ide   can   new   技术分享   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!