求实数的冥,虽然题没啥难度,为了弄下java做的
java就是方便啊,几行就搞定了c++近100行的东东,哎,为嘛STL不封装biginteger呢?
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public void slove()
{
Scanner cin = new Scanner(System.in);
while ( cin.hasNext() )
{
BigDecimal num = cin.nextBigDecimal();
int n = cin.nextInt();
BigDecimal sum = new BigDecimal("1");
String str;
while ( n > 0 )
{
if ( ( n & 1 ) > 0 )
sum = sum.multiply(num);
num = num.multiply(num);
n>>=1;
}
str= sum.stripTrailingZeros().toPlainString();
if ( str.startsWith("0.") )
str= str.substring(1);
System.out.println(str);
}
}
public static void main(String[] args) {
new Main().slove();
}
}