結果

問題 No.1578 A × B × C
コンテスト
ユーザー Aurora
提出日時 2021-09-12 12:19:39
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 501 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 932 ms
コンパイル使用メモリ 184,496 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-09 08:03:59
合計ジャッジ時間 2,002 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

long long int modpow(long long int a,long long int n,long long int mod){
  long long int res = 1;
  while(n>0){
    if(n&1) res = res*a%mod;
    a = a*a%mod;
    n >>= 1;
  }
  return res;
}

int main(){
  long long int A,B,C,K,MOD=1000000007;
  cin >> A >> B >> C >> K;
  A %= MOD;
  B %= MOD;
  C %= MOD;
  long long int ans = A*B;
  ans %= MOD;
  ans *= C;
  ans %= MOD;
  ans = modpow(ans,modpow(2,K,MOD-1),MOD);
  ans %= MOD;
  cout << ans << endl;
}
0