結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2016-07-23 01:40:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 614 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 23,424 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 15:34:15 |
合計ジャッジ時間 | 1,060 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | 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) { if(x == 0 && y == 0) { return 0; } 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; b %= MOD - 1; printf("%lld %lld\n", e(e(a, b), c), e(a, f(b, c)) ); return 0; }