結果

問題 No.2057 Ising Model
ユーザー kens
提出日時 2022-08-26 21:41:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 192,952 KB
最終ジャッジ日時 2025-01-31 04:31:02
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = -b*n + a*(n-1);
  ans = min(ans,-a*(n-1)-b*((n+1)/2)+b*(n/2));
  if(n % 2 == 0 && n >= 4) ans = min(ans,(n-3)*a-2*b);
  cout << ans << endl;
  return 0;
}
0