結果

問題 No.1578 A × B × C
ユーザー hongrock
提出日時 2021-07-08 09:58:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 3,574 ms
コンパイル使用メモリ 191,160 KB
最終ジャッジ日時 2025-01-22 18:07:27
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%lld %lld %lld %lld", &a, &b, &c, &K);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

using LL = long long;

const int mod = 1e9 + 7;

LL pow_mod(LL x, LL p, int mod){
	LL s = 1;
	for(; p; p>>=1){
		if(p & 1)	s = s * x % mod;
		x = x * x % mod;
	}
	return s;
}

int main(){
	LL a, b, c, K;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &K);
	printf("%lld\n", pow_mod(a * b % mod * c % mod, pow_mod(2, K, mod - 1), mod));
	
	return 0;
}
0