首页 > 其他 > 详细

NYOJ题目112指数运算

时间:2016-09-21 18:44:49      阅读:223      评论:0      收藏:0      [点我收藏+]

技术分享

------------------------

 

好水啊....

 

AC代码:

 1 import java.io.BufferedReader;
 2 import java.io.IOException;
 3 import java.io.InputStreamReader;
 4 import java.math.BigInteger;
 5 
 6 public class Main {
 7 
 8     public static void main(String[] args) throws IOException {
 9         
10         BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
11         
12         boolean first=true;
13         while(first || reader.ready()){
14             first=false;
15             String ss[]=reader.readLine().split(" ");
16             BigInteger ans=pow(Integer.parseInt(ss[0]),Integer.parseInt(ss[1]));
17             System.out.println(ans.toString());
18         }
19     }
20     
21     public static BigInteger pow(int a,int b){
22         BigInteger res=BigInteger.ONE;
23         for(int i=0;i<b;i++) res=res.multiply(BigInteger.valueOf(a));
24         return res;
25     }
26     
27 }

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=112

NYOJ题目112指数运算

原文:http://www.cnblogs.com/cc11001100/p/5893739.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!