結果

問題 No.91 赤、緑、青の石
ユーザー shinwisteriashinwisteria
提出日時 2017-04-02 20:05:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 204 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 3,649 ms
コンパイル使用メモリ 72,900 KB
実行使用メモリ 56,328 KB
最終ジャッジ日時 2023-09-06 12:29:00
合計ジャッジ時間 9,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
56,000 KB
testcase_01 AC 172 ms
56,180 KB
testcase_02 AC 156 ms
56,152 KB
testcase_03 AC 164 ms
56,284 KB
testcase_04 AC 146 ms
56,028 KB
testcase_05 AC 169 ms
56,264 KB
testcase_06 AC 141 ms
55,944 KB
testcase_07 AC 115 ms
55,552 KB
testcase_08 AC 117 ms
56,160 KB
testcase_09 AC 116 ms
55,516 KB
testcase_10 AC 118 ms
55,796 KB
testcase_11 AC 145 ms
56,120 KB
testcase_12 AC 172 ms
55,716 KB
testcase_13 AC 185 ms
56,088 KB
testcase_14 AC 161 ms
55,580 KB
testcase_15 AC 183 ms
56,328 KB
testcase_16 AC 117 ms
56,052 KB
testcase_17 AC 125 ms
55,840 KB
testcase_18 AC 127 ms
55,932 KB
testcase_19 AC 126 ms
56,076 KB
testcase_20 AC 124 ms
55,680 KB
testcase_21 AC 120 ms
55,892 KB
testcase_22 AC 115 ms
55,980 KB
testcase_23 AC 116 ms
55,912 KB
testcase_24 AC 119 ms
55,972 KB
testcase_25 AC 204 ms
56,220 KB
testcase_26 AC 195 ms
55,980 KB
testcase_27 AC 115 ms
56,080 KB
testcase_28 AC 137 ms
55,784 KB
testcase_29 AC 141 ms
55,928 KB
testcase_30 AC 160 ms
55,616 KB
testcase_31 AC 191 ms
56,020 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] + rgb[1] + rgb[2] >= 3){
			count += rgb[0];
			rgb[1] -= rgb[0];
			rgb[2] -= (rgb[0]+2);
			rgb[0] = 1;
			Arrays.sort(rgb);
		}
		System.out.println(count);

	}

}
0