結果
問題 | No.2057 Ising Model |
ユーザー |
|
提出日時 | 2022-08-26 21:56:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 2,071 ms |
コンパイル使用メモリ | 193,292 KB |
最終ジャッジ日時 | 2025-01-31 04:46:17 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { ll N,A,B; cin >> N >> A >> B; ll ans = numeric_limits<ll>::max(); ans = min(ans, A * (N - 1) - B * N); if(N % 2 == 0) { ans = min(ans, -A * (N - 3) - 2 * B); ans = min(ans, -A * (N - 1)); } else { ans = min(ans, -A * (N - 1) - B); } cout << ans << endl; }