a53

subimp3

a53
Dec 4th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int xlanmod(int x ,int n, int mod)
  5. {
  6. if(n==0) return 1;
  7. else
  8. {
  9. int p=xlanmod(x,n/2,mod);
  10. if(n%2==0) return p*p%mod;
  11. else return p*p%mod*x%mod;
  12. }
  13. }
  14.  
  15. int main()
  16. {
  17. int n;
  18. cin>>n;
  19. cout<<xlanmod(2,n-1,9001);
  20. return 0;
  21. }
Add Comment
Please, Sign In to add comment