fork download
  1. import java.util.*;
  2.  
  3. public class Main
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. Scanner in = new Scanner(System.in);
  8. int n = in.nextInt();
  9.  
  10. if ((n < 3) || (n > 5)) System.out.println("Solution does not exist.");
  11. else
  12. {
  13. double s_2 = Math.sin(Math.PI / n);
  14. s_2 *= s_2;
  15. double r = Math.sqrt(1-1/(4.0*s_2));
  16. System.out.println(r);
  17. }
  18. }
  19. }
Success #stdin #stdout 0.12s 29552KB
stdin
3
stdout
0.816496580927726