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