fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Depo
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. double n;
  10. double x, p=1;
  11. double cs, sc;
  12. Scanner in = new Scanner(System.in);
  13. x=in.nextDouble();
  14. n=in.nextDouble();
  15. cs= sc = Math.cos(Math.abs(x));
  16. for(int k=1; k<=n; k++){
  17. p*= (k / (k + 1)) - cs;
  18. cs*=sc;
  19. }
  20. System.out.println(p);
  21. }
  22. }
Success #stdin #stdout 0.15s 321280KB
stdin
1 4
stdout
0.0021201579171299867