結果

問題 No.91 赤、緑、青の石
ユーザー Daigo HIROOKA
提出日時 2018-07-03 02:09:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 215 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 3,315 ms
コンパイル使用メモリ 75,980 KB
実行使用メモリ 54,512 KB
最終ジャッジ日時 2024-06-24 07:15:34
合計ジャッジ時間 9,649 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

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};

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