結果
問題 |
No.403 2^2^2
|
ユーザー |
|
提出日時 | 2021-11-17 22:34:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 1,896 ms |
コンパイル使用メモリ | 167,560 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 05:25:32 |
合計ジャッジ時間 | 3,199 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 7 WA * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; int p = 1000000007; long long pow_re(long long a, long long n) { long long ans = 1; bitset<8> b(n); while (!b.none()) { if (b.test(0)) ans = ans * a % p; a = a * a % p; b = (b >> 1); } return ans; } int main() { long long a, b, c; string s; stringstream ss; cin >> s; for(int i = 0; i < s.length(); i++){ if(s.at(i) == '^') s.at(i) = ' '; } ss << s; ss >> a >> b >> c; cout << pow_re(pow_re(a, b), c) << " " << pow_re(a, pow_re(b, c)) << endl; }