fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Scanner;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. double k = 1;
  14. int n;
  15. Scanner in = new Scanner(System.in);
  16. while (in.hasNextInt())
  17. {
  18. n = in.nextInt();
  19. for ( int i = 366 - n; i <= 365; i++ ) {
  20. k = k * i;
  21. k = k / 365;
  22. }
  23. System.out.printf("%.8f",100 * ( 1 - k ));
  24. System.out.println("%");
  25. k=1;
  26. }
  27. }
  28. }
Success #stdin #stdout 0.06s 2184192KB
stdin
28
stdout
65.44614723%