Saleh127

cses 1617

Sep 25th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5.  
  6. ll mod(ll a,ll c,ll m)
  7. {
  8. if(c==0) return 1;
  9. ll x=mod(a,c/2,m);
  10. x=(x*x)%m;
  11. if(c%2)
  12. {
  13. x=(x*a)%m;
  14. }
  15. return x;
  16. }
  17.  
  18. int main()
  19. {
  20. ios_base::sync_with_stdio(0);
  21. cin.tie(0);cout.tie(0);
  22.  
  23. ll a,c;
  24. cin>>a;
  25.  
  26. c=mod(2,a,1000000007);
  27. cout<<c<<endl;
  28.  
  29.  
  30. return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment