結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2016-07-23 00:39:55 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 562 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 12:52:58 |
合計ジャッジ時間 | 1,285 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%lld%*c%lld%*c%lld", &a, &b, &c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #define MOD 1000000007 typedef long long int LL; LL p(LL x, LL y, LL z) { LL table[54]; table[0] = x; for(int i = 1; i < 54; i++) { table[i] = table[i - 1] * table[i - 1] % z; } LL ans = 1; for(int i = 0; i < 54; i++) { ans *= ((y>>i)&1 ? table[i] : 1); ans %= z; } return ans; } LL e(LL x, LL y) { return p(x, y, MOD); } LL f(LL x, LL y) { return p(x, y, MOD - 1); } int main () { LL a, b, c; scanf("%lld%*c%lld%*c%lld", &a, &b, &c); a %= MOD; printf("%lld %lld\n", e(e(a, b), c), e(a, f(b, c)) ); return 0; }