結果
| 問題 | No.1448 和差算 |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-02-11 00:38:38 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 667 bytes |
| 記録 | |
| コンパイル時間 | 3,966 ms |
| コンパイル使用メモリ | 337,504 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-02-11 00:38:53 |
| 合計ジャッジ時間 | 6,415 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
#include <atcoder/modint>
using mint = atcoder::modint1000000007;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll a, b, c, d, n;
cin >> a >> b >> c >> d >> n;
mint ans = mint(16).pow(n / 8);
n %= 8;
ll maxim = -1e18;
for (ll _x : { a, b }) {
for (ll _y : { c, d }) {
ll x = _x, y = _y;
rep(_, n) {
ll xx = x - y, yy = x + y;
swap(x, xx), swap(y, yy);
}
maxim = max(maxim, x + y);
}
}
ans *= maxim;
cout << ans.val() << '\n';
return 0;
}
a01sa01to