結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2018-11-21 22:45:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 1,716 ms |
コンパイル使用メモリ | 193,392 KB |
最終ジャッジ日時 | 2025-01-06 17:06:01 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:22:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%lld^%lld^%lld", &A, &B, &C); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; using int64 = long long; int64_t power(int64_t x, int64_t n, int64_t mod) { x %= mod; int64_t ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= mod; (x *= x) %= mod; n >>= 1; } return (ret); } const int mod = 1e9 + 7; int main() { int64 A, B, C; scanf("%lld^%lld^%lld", &A, &B, &C); cout << power(power(A, B, mod), C, mod) << " " << power(A, power(B, C, mod - 1), mod) << endl; }