POJ ACM 1002
2015-07-27 00:00
1231 查看
摘要: POJ ACM 1002
import java.math.BigDecimal; import java.util.Scanner; public class Main { static Scanner cin = new Scanner(System.in); public static void main(String[] args) { BigDecimal a,c; int b; while (cin.hasNext()) { a = cin.nextBigDecimal(); b = cin.nextInt(); c = a.pow(b); String ans = c.toPlainString(); if (ans.contains(".") == false) { System.out.println(ans); } else { int x = 0, y = ans.length() - 1; while (ans.charAt(x) == '0') x++; while (ans.charAt(y) == '0') y--; if (ans.charAt(y) != '.') y++; System.out.println(ans.substring(x, y)); } } } }
相关文章推荐
- 简单的四则运算
- 数的奇偶性
- ACM网址
- 1272 小希的迷宫
- 1272 小希的迷宫
- hdu 1250 大数相加并用数组储存
- 矩阵的乘法操作
- 蚂蚁爬行问题
- 蚂蚁爬行问题
- 求两个数的最大公约数【ACM基础题】
- 打印出二进制中所有1的位置
- 杭电题目---一只小蜜蜂
- POJ 2635 The Embarrassed Cryptographe
- POJ 3292 Semi-prime H-numbers
- POJ 2773 HAPPY 2006
- POJ 3090 Visible Lattice Points
- ACM题库以及培养策略
- 排序算法之快速排序
- 网易2018校招题
- Puzzle, ACM/ICPC World Finals 1993, UVa227