Poj Solution 1607

http://poj.org/problem?id=1607

//* @author popop0p0popo
import java.util.*;
import java.io.*;

public class Main{
 public static void main(String[] args) throws Exception{
  Scanner scanner=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    System.out.printf("Cards  Overhangn");
    int n;
    double d;
    while (scanner.hasNext()){
        n=scanner.nextInt();
        d=0;
        for (int i=1;i<=n ;i++ ){
            d=d+1.0/(2*i);
        }
        System.out.printf("%5d  %8.3fn",n,d);
    }
 }
}


											
This entry was posted in poj. Bookmark the permalink.