結果
問題 | No.1578 A × B × C |
ユーザー |
![]() |
提出日時 | 2021-07-02 21:48:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 3,877 bytes |
コンパイル時間 | 5,066 ms |
コンパイル使用メモリ | 262,588 KB |
最終ジャッジ日時 | 2025-01-22 15:53:21 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h>/*#include <boost/multiprecision/cpp_dec_float.hpp>#include <boost/multiprecision/cpp_int.hpp>namespace mp = boost::multiprecision;using bint = mp::cpp_int;*/#include <atcoder/all>#include <iostream>#include <queue>#include <stack>#include <vector>#include <string>#include <set>#include <map>#include <random>#include <bitset>#define rep(i,n) for (int i = 0; i < int(n); ++i)#define repp(i,n,m) for (int i = m; i < int(n); ++i)#define repb(i,n) for (int i = int(n)-1; i >= 0; --i)using namespace std;using namespace atcoder;using namespace internal;//alias g++='g++ -I/mnt/c/Users/Owner/Desktop/ac-library'using ll = long long;using ld = long double;using P = pair<int, int>;using PI = pair<pair<int,int>,int>;using PL = pair<long long, long long>;using PLL = pair<pair<long long, long long>, long long>;using Pxy = pair<long double, long double>;const int INF = 1001001007;const int modd = 1000000007;const long long modl = 1000000007LL;const long long mod = 998244353LL;const ll inf = 2e18;template <typename SA>void priv(vector<SA> &ar){if (ar.size() == 0) cout << endl;else {rep(i,ar.size()-1) cout << ar[i] << " ";cout << ar[ar.size()-1] << endl;}}template <typename SB>void privv(vector<vector<SB>> &ar){rep(i,ar.size()){rep(j,ar[i].size()-1) cout << ar[i][j] << " ";cout << ar[i][ar[i].size()-1] << endl;}}template <typename SC>bool range(SC a, SC b, SC x){return (a <= x && x < b);}bool rrange(P a, P b, P xy){bool s = range(a.first,b.first,xy.first);bool t = range(a.second,b.second,xy.second);return (s && t);}template <typename SE>void rev(vector<SE> &ar){reverse(ar.begin(),ar.end());}template <typename SD>void sor(vector<SD> &ar, int f = 0){sort(ar.begin(),ar.end()); if (f!=0) rev(ar);}template <typename SF>bool chmin(SF &a, const SF &b){if(a>b){a = b; return true;} return false;}template <typename SG>bool chmax(SG &a, const SG &b){if(a<b){a = b; return true;} return false;}template <typename SH>void eru(vector<SH> &ar){sor(ar);ar.erase(unique(ar.begin(),ar.end()),ar.end());}template <typename SI>SI last(vector<SI> &ar){return ar[ar.size()-1];}template <typename SJ>SJ cel(SJ a, SJ b){if (a % b == 0) return a/b; return a/b +1;}template <typename SK, typename SL>void pout(pair<SK,SL> p) {cout << p.first << " " << p.second << endl;}void yes(){cout << "Yes" << endl;}void no (){cout << "No" << endl;}void yn (bool t){if(t)yes();else no();}void Yes(){cout << "YES" << endl;}void No (){cout << "NO" << endl;}void YN (bool t){if(t)Yes();else No();}void dout() {cout << setprecision(20);}void deb(int h = 123456789) {cout << h << endl;}vector<int> dx = {0,1,0,-1};vector<int> dy = {1,0,-1,0};const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";const string alp = "abcdefghijklmnopqrstuvwxyz";ll gcds(ll a, ll b){a = abs(a); b = abs(b);if (b == 0) return a;ll c = a % b;while (c != 0){a = b;b = c;c = a % b;}return b;}ll tentou(vector<ll> ar){int n = ar.size();set<ll> st;rep(i,n) st.insert(ar[i]);map<ll,int> mp;int ind = 0;for (ll x : st){mp[x] = ind;ind++;}fenwick_tree<ll> fw(ind);ll ans = 0;rep(i,n){int a = mp[ar[i]];ans += i - fw.sum(0,a+1);fw.add(a,1);}return ans;}struct vs {vector<int> to;};ll ku(ll a, ll x, ll p){a %= p;if (x == 1) return a;ll ans = ku(a, x/2, p);ans *= ans;ans %= p;if (x % 2 == 1) ans *= a;return ans % p;}int main(){ll a, b, c; cin >> a >> b >> c;ll k; cin >> k;using mint = modint1000000007;mint ans = a;ans *= b * c;ll x = ku(2LL, k, modl-1);x += modl - 1;cout << ans.pow(x).val() << endl;}