結果
問題 | No.1578 A × B × C |
ユーザー |
|
提出日時 | 2021-07-02 22:46:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 2,148 ms |
コンパイル使用メモリ | 192,988 KB |
最終ジャッジ日時 | 2025-01-22 16:35:09 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using std::cin; using std::cout; using std::istream; using std::ostream; using ll = long long; // const int mod = 998244353; const int mod = 1000000007; ll qmi(ll m, ll k, ll p) { ll res = 1 % p, t = m; while (k) { if (k&1) res = res * t % p; t = t * t % p; k >>= 1; } return res; } int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ok = 0; if (k >= 31) ok = mod - 1; k = qmi(2, k, mod - 1) + ok; ll ans = qmi(a, k, mod) % mod * qmi(b, k, mod) % mod * qmi(c, k, mod) % mod; cout << ans << '\n'; return 0; }