Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main()
- {
- double x,answer=0;
- int n;
- cin>>n>>x;
- for(int i=1;i<=n;++i)
- answer+=cos((2*i-1)*x)/(1<<(2*i-1));
- cout<<answer<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement