結果

問題 No.2057 Ising Model
ユーザー ks2mks2m
提出日時 2022-08-26 21:31:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 2,902 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 37,116 KB
最終ジャッジ日時 2024-04-21 23:29:19
合計ジャッジ時間 7,070 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
36,640 KB
testcase_01 AC 63 ms
36,864 KB
testcase_02 AC 55 ms
37,012 KB
testcase_03 AC 56 ms
36,584 KB
testcase_04 AC 57 ms
37,004 KB
testcase_05 AC 56 ms
36,800 KB
testcase_06 AC 56 ms
37,036 KB
testcase_07 AC 55 ms
36,652 KB
testcase_08 AC 56 ms
36,980 KB
testcase_09 AC 54 ms
36,640 KB
testcase_10 AC 56 ms
37,064 KB
testcase_11 AC 55 ms
36,992 KB
testcase_12 WA -
testcase_13 AC 53 ms
36,636 KB
testcase_14 AC 53 ms
36,756 KB
testcase_15 AC 56 ms
36,756 KB
testcase_16 AC 52 ms
36,896 KB
testcase_17 AC 53 ms
36,776 KB
testcase_18 AC 54 ms
36,952 KB
testcase_19 AC 52 ms
36,752 KB
testcase_20 AC 54 ms
36,816 KB
testcase_21 AC 54 ms
36,676 KB
testcase_22 AC 54 ms
36,908 KB
testcase_23 WA -
testcase_24 AC 53 ms
36,768 KB
testcase_25 AC 52 ms
36,852 KB
testcase_26 AC 50 ms
36,676 KB
testcase_27 WA -
testcase_28 AC 56 ms
36,836 KB
testcase_29 AC 54 ms
36,748 KB
testcase_30 AC 54 ms
36,756 KB
testcase_31 AC 56 ms
36,540 KB
testcase_32 AC 56 ms
36,748 KB
testcase_33 AC 57 ms
36,540 KB
testcase_34 AC 53 ms
36,668 KB
testcase_35 AC 54 ms
36,836 KB
testcase_36 AC 52 ms
36,788 KB
testcase_37 AC 55 ms
36,512 KB
testcase_38 AC 53 ms
36,548 KB
testcase_39 AC 58 ms
36,676 KB
testcase_40 AC 54 ms
36,808 KB
testcase_41 AC 54 ms
37,012 KB
testcase_42 AC 53 ms
36,936 KB
testcase_43 AC 60 ms
36,676 KB
testcase_44 AC 60 ms
36,780 KB
testcase_45 WA -
testcase_46 AC 54 ms
36,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		long n = Long.parseLong(sa[0]);
		int a = Integer.parseInt(sa[1]);
		int b = Integer.parseInt(sa[2]);
		br.close();

		long v1 = (n - 1) * a - n * b;
		long n1 = n / 2;
		long n2 = n - n1;
		long v2 = (n - 1) * -a - n1 * b + n2 * b;
		long v3 = (n - 1) * -a + n1 * b - n2 * b;
		long ans = Math.min(Math.min(v1, v2), v3);
		System.out.println(ans);
	}
}
0