結果
| 問題 |
No.403 2^2^2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-18 21:01:52 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 423 bytes |
| コンパイル時間 | 196 ms |
| コンパイル使用メモリ | 28,928 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 03:13:24 |
| 合計ジャッジ時間 | 952 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
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 (long long)!!(a%mod);
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));
}