結果

問題 No.2175 Exciting Combo
ユーザー CecilCecil
提出日時 2023-01-12 19:57:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 71,812 KB
実行使用メモリ 56,436 KB
最終ジャッジ日時 2023-08-25 01:24:53
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
55,772 KB
testcase_01 AC 112 ms
55,540 KB
testcase_02 AC 110 ms
55,804 KB
testcase_03 AC 112 ms
55,900 KB
testcase_04 AC 116 ms
55,912 KB
testcase_05 AC 112 ms
56,276 KB
testcase_06 AC 110 ms
56,244 KB
testcase_07 AC 112 ms
55,768 KB
testcase_08 AC 115 ms
56,436 KB
testcase_09 AC 113 ms
56,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);

		int a1 = scan.hasNextInt() ? scan.nextInt() : -1;
		int a2 = scan.hasNextInt() ? scan.nextInt() : -1;
		int a3 = scan.hasNextInt() ? scan.nextInt() : -1;
		int b = scan.hasNextInt() ? scan.nextInt() : -1;
		if (a1 > 100 || a1 < 1 || a2 > 100 || a2 < 1 || a3 > 100 || a3 < 1 || b > 100 || b < 1) {
			System.out.println("入力エラー1");
			return;
		}
		if (a1 > a2 || a2 > a3) {
			System.out.println("入力エラー2");
			return;
		}

		int max = a3 * 3;
		int nol = a1 + a2 + a3 + b;

		int ans = 0;
		if(max < nol){
			ans = nol;
		}else{
			ans = max;
		}

		// 結果出力
		System.out.println(ans);

	}
}
0