結果
| 問題 |
No.403 2^2^2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-18 20:56:49 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 406 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 29,440 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 03:13:16 |
| 合計ジャッジ時間 | 1,041 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 4 |
コンパイルメッセージ
main.c:5:11: warning: conflicting types for built-in function 'pow'; expected 'double(double, double)' [-Wbuiltin-declaration-mismatch]
5 | long long pow(long long a, long long p, int mod) {
| ^~~
main.c:2:1: note: 'pow' is declared in header '<math.h>'
1 | #include<stdio.h>
+++ |+#include <math.h>
2 |
ソースコード
#include<stdio.h>
const int mm = 1000000007;
long long pow(long long a, long long p, int mod) {
if(!p) return 1LL;
long long res = pow(a, p>>1, mod);
res *= res;
res %= mod;
if(p&1) {
res *= a%mod;
res %= mod;
}
return res;
}
int main() {
long long a, b, c;
scanf("%lld^%lld^%lld", &a, &b, &c);
printf("%lld %lld\n", pow(pow(a, b, mm), c, mm), pow(a, pow(b, c, mm-1), mm));
}