Submission #19608

#TimeUsernameProblemLanguageResultExecution timeMemory
19608noeffservΑ (kriii4_P1)C++98
100 / 100
0 ms1716 KiB
#include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <functional> #include <cstring> #include <string> #include <map> #include <set> #include <iostream> #define ENP printf("**Entry Point**\n") #define A first #define B second #define MP make_pair using namespace std; typedef long long ll; typedef vector <double> vec_d; typedef vector <vec_d> vvec_d; typedef vector <int> vec_i; typedef vector <vec_i> vvec_i; typedef pair <int, int> pair_i; typedef pair < pair_i, pair_i > pp_i; const int INF = 0x60000000; const int MINF = -1000000000; const ll mod = 1000000007; const int cons = 50000001; ll table[64]; int main() { ll a, x; cin >> a >> x; a %= mod; table[1] = a; ll ans = 1; for (int i = 2; i < 64; i++) { table[i] = (table[i - 1] * table[i - 1]) % mod; } for (int i = 63; i >= 1; i--) { ll t = (1LL << (i - 1)); if (x >= t) { x -= t; ans = (ans * table[i]) % mod; } } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...