結果

問題 No.1578 A × B × C
ユーザー monnu
提出日時 2021-07-03 07:30:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 3,781 ms
コンパイル使用メモリ 228,312 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 01:15:05
合計ジャッジ時間 4,412 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000

ll modpow(ll a,ll n,ll mod){
  a%=mod;
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=ret*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ret;
}

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