結果

問題 No.2057 Ising Model
ユーザー gr1msl3y
提出日時 2022-08-26 23:58:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 177 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 51,840 KB
最終ジャッジ日時 2024-10-14 00:39:39
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

N, A, B = map(int, input().split())
ansa = A*(N-1)-B*N
ansb = -A*(N-1)-B*(N % 2)
ansc = -A*(N-3)-B*2
if N % 2:
    print(min(ansa, ansb))
else:
    print(min(ansa, ansb, ansc))
0