結果

問題 No.91 赤、緑、青の石
ユーザー shinwisteriashinwisteria
提出日時 2017-04-02 19:39:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 3,419 ms
コンパイル使用メモリ 72,396 KB
実行使用メモリ 57,992 KB
最終ジャッジ日時 2023-09-22 07:43:59
合計ジャッジ時間 8,900 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,748 KB
testcase_01 AC 131 ms
55,912 KB
testcase_02 AC 129 ms
55,464 KB
testcase_03 AC 128 ms
55,688 KB
testcase_04 AC 128 ms
55,884 KB
testcase_05 AC 129 ms
55,900 KB
testcase_06 WA -
testcase_07 AC 129 ms
55,900 KB
testcase_08 AC 129 ms
55,460 KB
testcase_09 AC 128 ms
55,680 KB
testcase_10 AC 132 ms
55,816 KB
testcase_11 AC 130 ms
55,680 KB
testcase_12 AC 130 ms
55,412 KB
testcase_13 AC 131 ms
55,676 KB
testcase_14 AC 129 ms
55,456 KB
testcase_15 AC 127 ms
55,688 KB
testcase_16 AC 129 ms
57,992 KB
testcase_17 AC 128 ms
55,772 KB
testcase_18 AC 129 ms
55,924 KB
testcase_19 AC 127 ms
55,456 KB
testcase_20 AC 128 ms
55,804 KB
testcase_21 AC 128 ms
56,228 KB
testcase_22 AC 130 ms
55,728 KB
testcase_23 AC 129 ms
55,924 KB
testcase_24 AC 129 ms
55,480 KB
testcase_25 AC 129 ms
55,732 KB
testcase_26 AC 130 ms
55,652 KB
testcase_27 AC 128 ms
55,712 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 127 ms
55,880 KB
testcase_31 AC 130 ms
55,760 KB
権限があれば一括ダウンロードができます

ソースコード

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[1]*3-rgb[2])/8;
			int i = (rgb[2]*3-rgb[1])/8;
			if(i == 0){
				if(rgb[2] >= 3){
					i = 1;
				}
			}
			rgb[0] = k + i;
			rgb[1] -= 2*k;
			rgb[2] -= 2*i;
			Arrays.sort(rgb);
			//System.out.println(rgb[0] + " " + rgb[1] + " " + rgb[2]);
		}
		System.out.println(count);

	}

}
0