Advertisement
elephantsarecool

1pol

Jan 11th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6.    double x,answer=0;
  7.    int n;
  8.    cin>>n>>x;
  9.    for(int i=1;i<=n;++i)
  10.        answer+=cos((2*i-1)*x)/(1<<(2*i-1));
  11.    cout<<answer<<endl;
  12.    return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement