Advertisement
a53

dinamica03

a53
Jan 19th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #define MOD 777013
  3. #define N 100001
  4. using namespace std;
  5. int ab[N],cd[N];
  6.  
  7. int main()
  8. {
  9. int n;
  10. cin>>n;
  11. ab[1]=cd[1]=2;
  12. for(int i=2;i<=n;++i)
  13. ab[i]=ab[i-1]+2*cd[i-1],cd[i]=2*ab[i-1]+2*cd[i-1],ab[i]%=MOD,cd[i]%=MOD;
  14. cout<<(ab[n]+cd[n])%MOD;
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement