This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub gtnao/algorithm
#define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/1/NTL_1_B" #include <bits/stdc++.h> using namespace std; #include "../../src/math/mod_pow.hpp" int main() { long long m, n; cin >> m >> n; cout << mod_pow(m, n, 1000000007LL) << endl; return 0; }
#line 1 "test/aoj/ntl_1_b.test.cpp" #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/1/NTL_1_B" #include <bits/stdc++.h> using namespace std; #line 2 "src/math/mod_pow.hpp" #line 4 "src/math/mod_pow.hpp" using namespace std; template <typename T = long long> T mod_pow(T a, T n, T mod) { T res = 1; while (n > 0) { if (n & 1) { res = res * a % mod; } a = a * a % mod; n >>= 1; } return res; } #line 8 "test/aoj/ntl_1_b.test.cpp" int main() { long long m, n; cin >> m >> n; cout << mod_pow(m, n, 1000000007LL) << endl; return 0; }