結果

問題 No.91 赤、緑、青の石
ユーザー shinwisteriashinwisteria
提出日時 2017-04-02 19:06:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 3,419 ms
コンパイル使用メモリ 72,824 KB
実行使用メモリ 56,036 KB
最終ジャッジ日時 2023-09-22 07:42:53
合計ジャッジ時間 9,540 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 122 ms
55,988 KB
testcase_08 AC 121 ms
55,556 KB
testcase_09 AC 120 ms
53,900 KB
testcase_10 AC 121 ms
55,676 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 121 ms
55,916 KB
testcase_17 AC 121 ms
55,820 KB
testcase_18 AC 120 ms
55,464 KB
testcase_19 AC 119 ms
55,892 KB
testcase_20 AC 121 ms
53,800 KB
testcase_21 AC 119 ms
55,888 KB
testcase_22 AC 121 ms
55,696 KB
testcase_23 AC 121 ms
55,968 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 121 ms
56,016 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 121 ms
53,932 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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