結果

問題 No.2057 Ising Model
ユーザー srjywrdnprkt
提出日時 2025-03-29 05:39:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 3,329 ms
コンパイル使用メモリ 272,864 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-29 05:39:09
合計ジャッジ時間 5,170 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/modint>

using namespace std;
//using namespace atcoder;
using ll = long long;
//using mint = modint998244353;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    /*
       +-+-にしてから++++などにする意味はない。
       +-+-+- -(N-1)*A-(N%2)*B
       ++++++ (N-1)*A-N*B
       の2通り
    */

    ll N, A, B;
    cin >> N >> A >> B;
    cout << min(-(N-1)*A-B*(N%2), (N-1)*A-N*B) << endl;

    return 0;
}
0