結果
問題 |
No.403 2^2^2
|
ユーザー |
![]() |
提出日時 | 2018-11-21 22:43:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 446 bytes |
コンパイル時間 | 1,731 ms |
コンパイル使用メモリ | 192,664 KB |
最終ジャッジ日時 | 2025-01-06 17:05:42 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:21:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | 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) { 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; }