結果
問題 |
No.1578 A × B × C
|
ユーザー |
|
提出日時 | 2021-12-21 01:21:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 2,713 bytes |
コンパイル時間 | 3,949 ms |
コンパイル使用メモリ | 251,824 KB |
最終ジャッジ日時 | 2025-01-27 04:22:40 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define ll int64_t #define u32 uint32_t #define u64 uint64_t constexpr ll inf = 1e17; constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}; constexpr int dy[] = {1, 0, -1, 0, 1, -1, 1, -1}; #define pii pair<int,int> #define pll pair<ll,ll> #define endl "\n" #define Auto const auto #define all(a) a.begin(),a.end() #define overload(_1,_2,_3,_4,name,...) name #define _rep1(n) for(int i = 0; i < (n); i++) #define _rep2(i,n) for(int i = 0; i < (n); i++) #define _rep3(i,a,b) for(int i = (a); i < (b); i++) #define _rep4(i,a,b,c) for(int i = (a); i < (b); i += (c)) #define rep(...) overload(__VA_ARGS__,_rep4,_rep3,_rep2,_rep1)(__VA_ARGS__) #define _rrep1(n) for(int i = (n) - 1; i >= 0; i--) #define _rrep2(i,n) for(int i = (n) - 1; i >= 0; i--) #define _rrep3(i,a,b) for(int i = (b) - 1; i >= (a); i--) #define _rrep4(i,a,b,c) for(int i = (b) - 1; i >= (a); i -= (c)) #define rrep(...) overload(__VA_ARGS__,_rrep4,_rrep3,_rrep2,_rrep1)(__VA_ARGS__) #define F function template <class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return 1; } return 0; } template <class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return 1; } return 0; } struct Edge { int to; ll cost; Edge(int to, ll cost) : to(to), cost(cost) {} }; using Graph = vector<vector<Edge>>; template<class T> istream& operator>>(istream& is, vector<T>& a){ for(auto& x : a) is >> x; return is; } template<class T> void operator+=(vector<T>& a, T b){ a.push_back(b); return; } template<class T> istream& operator>>(istream& is, set<T>& a){ T input; is >> input; a.insert(input); return is; } template<class T> void operator+=(set<T>& a, T b){ a.insert(b); return; } struct sorted_impl{ template<class T> friend vector<T> operator|(vector<T> a, sorted_impl){ sort(all(a)); return a; } template<class T> friend void operator|=(vector<T>& a, sorted_impl){ sort(all(a)); } } sorted; struct reversed_impl{ template<class T> friend vector<T> operator|(vector<T> a, reversed_impl){ reverse(all(a)); return a; } template<class T> friend void operator|=(vector<T>& a, reversed_impl){ reverse(all(a)); } } reversed; ll mow(ll x, ll n){ ll ret = 1; while(n > 0){ if(n & 1) ret = ret * x; x = x * x; n >>= 1; } return ret; } ll mow(ll x, ll n, ll mod){ ll ret = 1; while(n > 0){ if(n & 1) ret = ret * x % mod; x = x * x % mod; n >>= 1; } return ret; } void Main(){ constexpr ll mod = 1000000007; ll a, b, c, k; cin >> a >> b >> c >> k; cout << mow((((a * b) % mod) * c) % mod, mow(2, k, mod - 1), mod) << endl; } signed main(){ cin.tie(0); ios::sync_with_stdio(0); cout << setprecision(10) << fixed; Main(); }