fzu1856 The Troop
http://acm.fzu.edu.cn/problem.php?pid=1856
//ans = (sqrt(2)+1)*x, 203ms 34180KB
import java.math.*;
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
BigDecimal x,cell = BigDecimal.ONE ;//= 2.4142135623730950488016887242097;
cell = cell.add( new BigDecimal( Math.sqrt(2.0) ) );
String str;
int t = 1;
while(cin.hasNext()){
x = cin.nextBigDecimal();
x = x.multiply(cell);
str = x.toString();
System.out.println("Case " + t);
t++;
if(x.compareTo( BigDecimal.valueOf(100000.0) ) >= 0) {
System.out.println( str.substring(0, 5) );
}else{
x = x.divide(BigDecimal.ONE, 4, RoundingMode.HALF_UP);
System.out.println(x);}
System.out.println();
}
}
}
浙公网安备 33010602011771号