Advertisement
a53

Depozit

a53
Jan 17th, 2022 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <cstdio>
  2. #define M 1000000007
  3. using namespace std;
  4.  
  5. int p_log(int n,int p)
  6. {
  7. int r;
  8. for(r=1;p;p>>=1) /// Calculez n^p modulo M
  9. {
  10. if(p&1)
  11. r=((long long)r*n)%M;
  12. n=((long long)n*n)%M;
  13. }
  14. return r;
  15. }
  16.  
  17. int main(void)
  18. {
  19. int n;
  20. scanf("%d",&n);
  21. printf("%d %d\n",(p_log(2,n)-1+M)%M,(p_log(2,n+1)-n-2+M)%M);
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement