結果

問題 No.1578 A × B × C
ユーザー the-xin
提出日時 2021-07-02 21:48:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 67,996 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 11:20:01
合計ジャッジ時間 1,328 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL mod=1e9+7;
LL qpow(LL x,LL k,LL mod){
	LL res=1;
	while(k){
		if(k&1)res=res*x%mod;
		x=x*x%mod;
		k>>=1;
	}
	return res;
}
int main(){
	LL a,b,c,k;
	cin>>a>>b>>c>>k;
	LL flag=0;
	if(k>=30)flag=mod-1;
	k=qpow(2,k,mod-1)+flag;
	LL res=qpow(a,k,mod)%mod*qpow(b,k,mod)%mod*qpow(c,k,mod)%mod;
	cout<<res;
	return 0;
}
0