結果

問題 No.91 赤、緑、青の石
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-03 02:03:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 3,788 ms
コンパイル使用メモリ 72,740 KB
実行使用メモリ 58,908 KB
最終ジャッジ日時 2023-09-13 17:11:00
合計ジャッジ時間 10,081 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
58,400 KB
testcase_01 AC 184 ms
58,744 KB
testcase_02 AC 168 ms
58,320 KB
testcase_03 AC 185 ms
58,432 KB
testcase_04 AC 164 ms
58,908 KB
testcase_05 AC 188 ms
58,332 KB
testcase_06 AC 157 ms
58,712 KB
testcase_07 WA -
testcase_08 AC 120 ms
56,624 KB
testcase_09 AC 124 ms
56,032 KB
testcase_10 AC 122 ms
57,892 KB
testcase_11 AC 159 ms
58,492 KB
testcase_12 AC 189 ms
58,472 KB
testcase_13 AC 207 ms
58,412 KB
testcase_14 AC 177 ms
58,532 KB
testcase_15 AC 202 ms
58,512 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 120 ms
55,900 KB
testcase_19 AC 120 ms
56,060 KB
testcase_20 AC 120 ms
56,352 KB
testcase_21 AC 119 ms
55,824 KB
testcase_22 AC 120 ms
55,856 KB
testcase_23 AC 119 ms
56,104 KB
testcase_24 AC 120 ms
55,524 KB
testcase_25 AC 228 ms
58,536 KB
testcase_26 AC 222 ms
58,464 KB
testcase_27 AC 121 ms
54,300 KB
testcase_28 AC 152 ms
58,308 KB
testcase_29 AC 163 ms
58,632 KB
testcase_30 AC 177 ms
58,136 KB
testcase_31 AC 221 ms
58,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		int[] rgb = new int[]{r, g, b};
		Arrays.sort(rgb);

		while(true){
			int[] rgb_new = new int[]{rgb[0]+1, rgb[1], rgb[2]-2};
			Arrays.sort(rgb_new);
			if(rgb_new[2]-rgb_new[0] <= 2){
				rgb = rgb_new;
				break;
			}else{
				rgb = rgb_new;
			}
			// System.out.println(Arrays.toString(rgb));
		}
		System.out.println(rgb[0]);
	}
}
0