結果

問題 No.91 赤、緑、青の石
ユーザー shinwisteria
提出日時 2017-04-02 19:06:08
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 3,372 ms
コンパイル使用メモリ 75,388 KB
実行使用メモリ 56,220 KB
最終ジャッジ日時 2024-07-08 00:12:14
合計ジャッジ時間 7,225 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class RGB {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s= new Scanner(System.in);
		int[] rgb = new int[3];
		for(int i = 0;i < 3;i++){
			rgb[i] = s.nextInt();
		}
		s.close();
		int count = 0;
		Arrays.sort(rgb);
		while(rgb[0] != 0 || rgb[2] >= 3){
			count += rgb[0];
			rgb[1] -= rgb[0];
			rgb[2] -= rgb[0];
			int k = rgb[2]/3;
			rgb[0] = k;
			rgb[2] -= 2*k;
			Arrays.sort(rgb);
		}
		System.out.println(count);

	}

}
0