开方数
时间限制:500 ms | 内存限制:65535 KB 难度:3- 描述
-
现在给你两个数 n 和 p ,让你求出 p 的开 n 次方。
- 输入
- 每组数据包含两个数n和p。当n和p都为0时表示输入结束。(1<=n<=200,1<=p<=10^101)
- 输出
- 对于每个输出对用输出开方后的结果k(结果小于10^9)。
- 样例输入
-
2 16 3 27 7 4357186184021382204544 0 0
- 样例输出
-
4 3 1234
import java.util.Scanner; public class Main {//Accepted 40 495 java 2014-03-12 21:22:17 public static void main(String[] args){ Scanner input=new Scanner(System.in); //BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); while(true){ int n=input.nextInt(); double p=input.nextDouble(); if(n==0&&p==0) break; System.out.println(String.format("%.0f", Math.pow(p, 1.0/n))); } } }
- <script type="text/java script">BAIDU_CLB_fillSlot("771048");
- 点击复制链接 与好友分享! 回本站首页 <script> function copyToClipBoard(){ var clipBoardContent=document.title + '\r\n' + document.location; clipBoardContent+='\r\n'; window.clipboardData.setData("Text",clipBoardContent); alert("恭喜您!复制成功"); }
<script type="text/java script" id="bdshare_js" data="type=tools&uid=12732"> <script type="text/java script" id="bdshell_js"> <script type="text/java script"> var bds_config = {'snsKey':{'tsina':'2386826374','tqq':'5e544a8fdea646c5a5f3967871346eb8'}}; document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js cdnversion=" + Math.ceil(new Date()/3600000) - 您对本文章有什么意见或着疑问吗?请到 论坛讨论您的关注和建议是我们前行的参考和动力
- 上一篇: Spring-Context之三:使用XML和Groovy DSL配置Bean
- 下一篇: 最后一页
- 相关文章
- <script type="text/java script">BAIDU_CLB_fillSlot("182716");
- <script type="text/java script">BAIDU_CLB_fillSlot("517916");
- 图文推荐
<iframe src="http://www.2cto.com/uapi.php tid=285261&catid=85&title=v6q3vcr9X255Xzc3Myi088r9KS5qYXZh&forward=http://www.2cto.com/kf/201403/285261.html" width="100%" height="100%" id="comment_iframe" name="comment_iframe" frameborder="0" scrolling="no">
- <script type="text/java script">BAIDU_CLB_fillSlot("771057");



