結果

問題 No.91 赤、緑、青の石
ユーザー Daigo HIROOKA
提出日時 2018-07-03 02:03:45
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 3,583 ms
コンパイル使用メモリ 74,240 KB
実行使用メモリ 57,100 KB
最終ジャッジ日時 2024-07-01 01:53:37
合計ジャッジ時間 10,746 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 26 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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