fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. double x, p = 1;
  8. double cs, sc;
  9. cin >> x;
  10. cin >> n;
  11. cs = cos(fabs(x));
  12. sc = cos(fabs(x));
  13. for(int k = 1; k <=n; k++)
  14. {
  15. p*= (k / (k + 1)) - cs;
  16. cs*=sc;
  17. }
  18. cout << p << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3432KB
stdin
50
16
stdout
0.00782772