結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2020-06-02 13:51:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 699 bytes |
コンパイル時間 | 1,121 ms |
コンパイル使用メモリ | 160,128 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-23 18:27:01 |
合計ジャッジ時間 | 1,922 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%lld^%lld^%lld",&a,&b,&c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.02 13:46:50 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; //powMod ll powMod(ll k, ll n, ll mod) { ll x = 1; while (n > 0) { if (n & 1) { x = x * k % mod; } k = k * k % mod; n >>= 1; } return x; } int main() { const int MOD = 1000000007; ll a,b,c; scanf("%lld^%lld^%lld",&a,&b,&c); a %= MOD; if (a == 0) { cout << 0 << " " << 0 << endl; return 0; } cout << powMod(a,(b % (MOD - 1)) * (c % (MOD - 1)), MOD) << " "; cout << powMod(a,powMod((b % (MOD - 1)),c,MOD-1),MOD) << endl; return 0; }