結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2016-08-15 08:07:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 64,000 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 16:56:27 |
合計ジャッジ時間 | 1,477 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <iostream>using namespace std;int modpow(long long a, long long b, int m) {if(a == 0 && b == 0) return 0;int ret = 1; a %= m;for(int i = 60; i >= 0; i--) {ret = 1LL * ret * ret % m;if(b & (1LL << i)) ret = 1LL * ret * a % m;}return ret;}const int mod = 1000000007;long long A, B, C; char buf;int main() {cin >> A >> buf >> B >> buf >> C; A %= 1000000007;int res1 = modpow(modpow(A, B, mod), C, mod);int res2 = modpow(A, modpow(B, C, mod - 1), mod);cout << res1 << ' ' << res2 << endl;return 0;}