結果
問題 | No.403 2^2^2 |
ユーザー |
|
提出日時 | 2016-07-26 17:52:57 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 854 bytes |
コンパイル時間 | 442 ms |
コンパイル使用メモリ | 56,436 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 17:08:35 |
合計ジャッジ時間 | 1,345 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <iostream>#include <string>#include <ctype.h>using namespace std;typedef unsigned long long INT;#define mul(a,b,m) ((a)*(b)%(m))const INT MOD = 1000000007;INT A, B, C;void input(){string s;cin >> s;int n = 0;for (; isdigit(s[n]); n++) {A = (A * 10) + (s[n] - '0');}n++;for (; isdigit(s[n]); n++) {B = (B * 10) + (s[n] - '0');}n++;for (; isdigit(s[n]); n++) {C = (C * 10) + (s[n] - '0');}}INT modpow(INT x, INT n, INT mod){INT r = n? 1: 0;while (n) {if (n & 1) {r = mul(r, x, mod);}x = mul(x, x, mod);n >>= 1;}return r;}int main(){input();cout << modpow(modpow(A%MOD, B, MOD), C, MOD) << ' ';cout << modpow(A%MOD, modpow(B%(MOD-1), C, MOD-1), MOD) << endl;}