結果

問題 No.1578 A × B × C
ユーザー You_saku
提出日時 2021-09-18 18:51:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 90,108 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 16:42:21
合計ジャッジ時間 1,579 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<ios>
#include<iomanip> 
#include<cmath>
#include<limits>
#include<algorithm>

using namespace std;

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

long long  MOD = 1000000007;
int main(){
    long long a,b,c,k;
    cin >> a >> b >> c;
    cin >> k;

    long long digit = modpow(2,k,MOD-1);
    (a*=b)%=MOD;
    (a*=c)%=MOD;
    cout << modpow(a,digit,MOD) << endl;
    return 0;
}
0