結果

問題 No.91 赤、緑、青の石
ユーザー kano_townkano_town
提出日時 2014-12-07 19:30:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 5,000 ms
コード長 757 bytes
コンパイル時間 3,890 ms
コンパイル使用メモリ 76,744 KB
実行使用メモリ 56,476 KB
最終ジャッジ日時 2023-09-06 12:05:45
合計ジャッジ時間 9,821 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
55,964 KB
testcase_01 AC 146 ms
56,040 KB
testcase_02 AC 151 ms
55,672 KB
testcase_03 AC 148 ms
55,380 KB
testcase_04 AC 154 ms
55,508 KB
testcase_05 AC 146 ms
56,068 KB
testcase_06 AC 148 ms
55,948 KB
testcase_07 AC 129 ms
55,336 KB
testcase_08 AC 130 ms
55,764 KB
testcase_09 AC 129 ms
55,784 KB
testcase_10 AC 128 ms
55,884 KB
testcase_11 AC 162 ms
55,736 KB
testcase_12 AC 156 ms
55,892 KB
testcase_13 AC 150 ms
55,940 KB
testcase_14 AC 148 ms
55,544 KB
testcase_15 AC 152 ms
55,768 KB
testcase_16 AC 124 ms
55,936 KB
testcase_17 AC 122 ms
55,788 KB
testcase_18 AC 122 ms
55,588 KB
testcase_19 AC 121 ms
55,956 KB
testcase_20 AC 122 ms
55,788 KB
testcase_21 AC 122 ms
55,616 KB
testcase_22 AC 122 ms
55,980 KB
testcase_23 AC 124 ms
55,916 KB
testcase_24 AC 124 ms
55,680 KB
testcase_25 AC 152 ms
56,476 KB
testcase_26 AC 151 ms
55,956 KB
testcase_27 AC 150 ms
55,816 KB
testcase_28 AC 151 ms
55,656 KB
testcase_29 AC 144 ms
55,564 KB
testcase_30 AC 146 ms
55,920 KB
testcase_31 AC 151 ms
55,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder91 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long r = sc.nextLong(), g = sc.nextLong(), b = sc.nextLong();
		long sum = (r + g + b) / 3;
		long res = 0;
		while (true) {
			if (r == 0) {
				if (Math.max(b, g) > 2) {
					if (b > g) b -= 2;
					else g -= 2;
				}
				else break;
				r++;
			}
			if (g == 0) {
				if (Math.max(r, b) > 2) {
					if (r > b) r -= 2;
					else b -= 2;
				}
				else break;
				g++;
			}
			if (b == 0) {
				if (Math.max(r, g) > 2) {
					if (r > g) r -= 2;
					else g -= 2;
				}
				else break;
				b++;
			}
			r--;
			g--;
			b--;
			res++;
		}
		System.out.println("" + res);

	}
}
0