結果
問題 | No.2057 Ising Model |
ユーザー |
![]() |
提出日時 | 2022-08-27 01:05:07 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 333 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-10-14 01:38:48 |
合計ジャッジ時間 | 5,926 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
コンパイルメッセージ
Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:9: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
N, A, B = gets.split.map(&:to_i)if N % 2 == 0if 2 * A > Bif A > Bputs -1 * A * (N - 1)elseif N > 2puts -1 * A * (N - 3) - B * 2elseputs -1 * A - 2 * Bendendelseputs A * (N - 1) - B * Nendelseif 2 * A > Bputs A * -1 * (N - 1) - Belseputs A * (N - 1) - B * Nendend