Advertisement
Guest User

NumarDESubmultimi_eu

a guest
Nov 12th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define MOD 777013
  3. #define ll long long
  4. using namespace std;
  5. ll n, a, b, c;
  6. int main()
  7. {
  8.     cin>>n;
  9.     if(n==1)
  10.     {
  11.         cout<<1;
  12.         return 0;
  13.     }
  14.     if(n==2)
  15.     {
  16.         cout<<2;
  17.         return 0;
  18.     }
  19.     a=1; b=2;
  20.     for(ll i=3; i<=n; i++)
  21.     {
  22.         c=(a+b+1)%MOD;
  23.         a=b;
  24.         b=c;
  25.     }
  26.     cout<<c;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement