fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int MOD = 1000000007;
  6.  
  7. long long power(long long x, long long y) {
  8. long long res = 1;
  9. x %= MOD;
  10. while (y > 0) {
  11. if (y & 1)
  12. res = (res * x) % MOD;
  13. y >>= 1;
  14. x = (x * x) % MOD;
  15. }
  16. return res;
  17. }
  18.  
  19. int main() {
  20. int n;
  21. cin >> n;
  22.  
  23. // Số lần chuyển đĩa
  24. long long result = (power(2, n) - 1 + MOD) % MOD;
  25.  
  26. cout << result << endl;
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5300KB
stdin
1
stdout
1