hdu 1063 Exponentiation

http://acm.hdu.edu.cn/showproblem.php?pid=1063

 1 import java.math.BigDecimal;
2 import java.util.*;
3 public class Main {
4 public static void main(String []args)
5 {
6 Scanner cin=new Scanner(System.in);
7 BigDecimal r,mutil;
8 String ans;
9 int n;
10 while(cin.hasNextBigDecimal())
11 {
12 r=cin.nextBigDecimal();
13 n=cin.nextInt();
14 mutil=r.pow(n);//乘方
15 mutil=mutil.stripTrailingZeros();//去掉后导零
16 ans=mutil.toPlainString();
17 if(ans.indexOf(‘0‘)==0)
18 {
19 ans=ans.substring(1);//小于零去掉零
20 }
21 System.out.println(ans);
22 }
23 }
24
25 }

hdu 1063 Exponentiation,布布扣,bubuko.com

时间: 2024-10-25 11:33:52

hdu 1063 Exponentiation的相关文章

hdu 1063 Exponentiation (高精度小数乘法)

//大数继续,额,要吐了. Problem Description Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems. This problem re

hdu 1063 Exponentiation 大数

Problem Description Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems. This problem requires that yo

HDOJ 1063 Exponentiation

JAVA大数.... xx.stripTrailingZeros().toPlainString() 去末尾的0并不用科学计数法显示 Exponentiation Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6740    Accepted Submission(s): 1882 Problem Description Problem

HDUJ 1063 Exponentiation

Exponentiation Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6818    Accepted Submission(s): 1911 Problem Description Problems involving the computation of exact values of very large magnitude

HDU ACM 1063 Exponentiation 大实数乘方

分析:大实数乘方计算. #include<iostream> #include<string> using namespace std; struct BigReal //高精度实数 { int len; //长度 int num[10000]; int point; //小数点位置 BigReal() { len=1; point=0; memset(num,0,sizeof(num)); } }; bool Read(BigReal& a) //读入一个大实数 { st

HDU 1063/POJ 1001-Exponentiation(大数类)

Exponentiation Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6948    Accepted Submission(s): 1967 Problem Description Problems involving the computation of exact values of very large magnitude

【HDOJ】1063 Exponentiation

这道题目莫名其妙的wa,又莫名其妙的过了. 1 import java.util.Scanner; 2 import java.math.BigDecimal; 3 4 public class Main { 5 public static void main(String[] args) { 6 Scanner cin = new Scanner(System.in); 7 while (cin.hasNext()) { 8 BigDecimal br = cin.nextBigDecimal

HDU高精度总结(java大数类)

  HDU1002   A + B Problem II [题意]大数相加 [链接]http://acm.hdu.edu.cn/showproblem.php?pid=1002 Sample Input 2 1 2 112233445566778899 998877665544332211 Sample Output Case 1: 1 + 2 = 3 Case 2: 112233445566778899 + 998877665544332211 = 1111111111111111110 代码

Exponentiation(java 大实数)

http://acm.hdu.edu.cn/showproblem.php?pid=1063 Exponentiation Time Limit: 2000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8076    Accepted Submission(s): 2279 Problem Description Problems involving the compu