锘??xml version="1.0" encoding="utf-8" standalone="yes"?> Description Input Output Sample Input Sample Output
import java.util.*;
import java.math.*;
public class Main{
public static void main( String args[] )
{
Scanner in = new Scanner( System.in );
int cnt = 0;
BigInteger fib1, fib2;
BigInteger fla1, fla2;
while( in.hasNext() )
{
fib1 = BigInteger.valueOf(1);
fib2 = BigInteger.valueOf(2);
fla1 = in.nextBigInteger();
fla2 = in.nextBigInteger();
if( fla1.equals(BigInteger.valueOf(0)) && fla2.equals(BigInteger.valueOf(0))) break;
cnt = 0;
while( true )
{
if( fib1.compareTo(fla1) >= 0 && fib1.compareTo(fla2) <= 0 ) cnt++;
if( fib2.compareTo(fla1) >= 0 && fib2.compareTo(fla2) <= 0 ) cnt++;
if( fib1.compareTo(fla2) > 0 || fib2.compareTo(fla2) > 0 ) break;
fib1 = fib1.add(fib2);
fib2 = fib2.add(fib1);
}
System.out.println( cnt );
}
}
}
]]>
Time Limit: 500MS
Memory Limit: 10000K
Total Submissions: 68964
Accepted: 16146
This problem requires that you write a program to compute the exact value of Rn where R is a real number ( 0.0 < R < 99.999 ) and n is an integer such that 0 < n <= 25.95.123 12
0.4321 20
5.1234 15
6.7592 9
98.999 10
1.0100 12
548815620517731830194541.899025343415715973535967221869852721
.00000005148554641076956121994511276767154838481760200726351203835429763013462401
43992025569.928573701266488041146654993318703707511666295476720493953024
29448126.764121021618164430206909037173276672
90429072743629540498.107596019456651774561044010001
1.126825030131969720661201
铏界劧鏁堢巼浣庣偣鍎匡紝浣嗕唬鐮侀潪甯哥畝鍗曪紝瀹規(guī)槗瀹炵幇錛岀湡姝f瘮璧涜繕鏄緢濂界敤鐨勩傘傘?br />
import java.util.*;
import java.math.*;
public class Main{
public static void main( String args[] )
{
BigDecimal num;
int n;
String r;
Scanner cin = new Scanner(System.in);
while(cin.hasNextBigDecimal())
{
num = cin.nextBigDecimal();
n = cin.nextInt();
num = num.pow(n);
r = num.stripTrailingZeros().toPlainString();//BigDecimal.toPlainString 閬垮厤杈撳嚭鏃朵駭鐢熺瀛﹁鏁版硶褰㈠紡
if(r.startsWith("0."))
r = r.substring(1);
System.out.println(r);
}
}
}
]]>