SHARE
TWEET

Untitled

a guest Nov 6th, 2019 12 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. #define x first
  5. #define y second
  6. #define y1 Y1
  7. #define y2 Y2
  8. #define mp make_pair
  9. #define pb push_back
  10.  
  11. using namespace std;
  12.  
  13. typedef long long LL;
  14. typedef pair<int, int> pii;
  15.  
  16. template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
  17. template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
  18.  
  19. inline void proc_status()
  20. {
  21.     ifstream t ("/proc/self/status");
  22.     cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) <<endl;
  23. }
  24.  
  25. template <typename T> T read ()
  26. {
  27.     T sum = 0, fl = 1; char ch = getchar();
  28.     for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
  29.     for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
  30.     return sum * fl;
  31. }
  32.  
  33. const int Maxn = 1000000 + 100, Mod = 1e9 + 7;
  34.  
  35. int N, M;
  36.  
  37. inline int Pow (int a, int b)
  38. {
  39.     int ans = 1;
  40.     for (int i = b; i; i >>= 1, a = 1ll * a * a % Mod) if (i & 1) ans = 1ll * ans * a % Mod;
  41.     return ans;
  42. }
  43.  
  44. inline void Solve ()
  45. {
  46.     printf("%lld\n", 1ll * Pow((2ll * N + 2) % Mod, M) * (N + 1 - M) % Mod * Pow(N + 1, Mod - 2) % Mod);
  47. }
  48.  
  49. inline void Input ()
  50. {
  51.     N = read<int>(), M = read<int>();
  52. }
  53.  
  54. int main()
  55. {
  56. #ifndef ONLINE_JUDGE
  57.     freopen("A.in", "r", stdin);
  58.     freopen("A.out", "w", stdout);
  59. #endif
  60.     Input();
  61.     Solve();
  62.     return 0;
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top