結果
問題 | No.1578 A × B × C |
ユーザー |
![]() |
提出日時 | 2021-07-24 19:07:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 736 bytes |
コンパイル時間 | 1,732 ms |
コンパイル使用メモリ | 166,460 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-20 01:29:50 |
合計ジャッジ時間 | 2,936 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long long#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define Pr pair<ll,ll>#define Tp tuple<ll,ll,ll>using Graph = vector<vector<int>>;const ll mod = 1000000007;//累乗 aのb乗、正しmを法として求めるlong long pw(long long a,long long b,long long m){if(b==0) return 1;else if(b%2==0){long long x = pw(a,b/2,m);return (x*x)%m;}else{long long x = pw(a,b-1,m);return (a*x)%m;}}int main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);ll A,B,C,K; cin >> A >> B >> C >> K;ll M = pw(2LL,K,mod-1);ll ans = pw((((A*B)%mod)*C%mod),M,mod);cout << ans << endl;}