結果

問題 No.403 2^2^2
ユーザー e869120e869120
提出日時 2016-08-15 08:00:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 54,232 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 06:45:21
合計ジャッジ時間 1,147 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%lld^%lld^%lld",&A,&B,&C);A%=MOD;B%=MOD;C%=MOD;
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<cstdio>
using namespace std;
#define MOD 1000000007
long long modpow(long long a,long long b,long long c){
	long long bit[63],G[63],sum=1;G[0]=a;
	for(int i=1;i<63;i++){G[i]=G[i-1]*G[i-1];G[i]%=c;}
	for(int i=0;i<63;i++){bit[i]=(b/(1LL<<i))%2;}
	for(int i=0;i<63;i++){if(bit[i]==1){sum*=G[i];sum%=c;}}
	return sum;
}
int main(){
	long long A,B,C;
	scanf("%lld^%lld^%lld",&A,&B,&C);A%=MOD;B%=MOD;C%=MOD;
	printf("%lld %lld\n",modpow(modpow(A,B,MOD),C,MOD),modpow(A,modpow(B,C,MOD-1),MOD));
	return 0;
}
0