Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///https://trello.com/c/r2Wlhzup/52-problem-166e-codeforces
- ///http://codeforces.com/problemset/problem/166/E
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned long long A=0, D=1;
- unsigned long long A0, D0;
- int n;
- cin>>n;
- for (int i=1; i<=n; i++)
- {
- A0 = 2*A + D;
- D0 = 3*A;
- A = A0%1000000007;
- D = D0%1000000007;
- }
- cout<<D<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment