結果

問題 No.91 赤、緑、青の石
ユーザー spaciaspacia
提出日時 2016-01-10 04:52:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,177 bytes
コンパイル時間 3,921 ms
コンパイル使用メモリ 77,396 KB
実行使用メモリ 53,592 KB
最終ジャッジ日時 2023-10-19 19:44:53
合計ジャッジ時間 7,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
52,580 KB
testcase_01 WA -
testcase_02 AC 58 ms
53,556 KB
testcase_03 AC 58 ms
53,560 KB
testcase_04 AC 57 ms
53,560 KB
testcase_05 AC 58 ms
52,592 KB
testcase_06 WA -
testcase_07 AC 57 ms
53,556 KB
testcase_08 AC 57 ms
52,472 KB
testcase_09 AC 55 ms
51,660 KB
testcase_10 AC 56 ms
53,556 KB
testcase_11 AC 56 ms
53,564 KB
testcase_12 AC 58 ms
53,568 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 57 ms
52,608 KB
testcase_17 AC 57 ms
52,640 KB
testcase_18 AC 58 ms
53,568 KB
testcase_19 AC 57 ms
53,564 KB
testcase_20 AC 56 ms
53,504 KB
testcase_21 AC 57 ms
53,564 KB
testcase_22 AC 57 ms
51,512 KB
testcase_23 AC 57 ms
53,564 KB
testcase_24 AC 56 ms
53,556 KB
testcase_25 AC 57 ms
53,564 KB
testcase_26 AC 58 ms
53,584 KB
testcase_27 AC 59 ms
52,500 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 57 ms
52,504 KB
testcase_31 AC 56 ms
53,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (int[] prob) {
		//out(Arrays.toString(prob));
		if (prob[2] == 0) return 0;
		if (prob[1] == 0) return prob[2] / 5;
		if (prob[0] == 0) {
			if (prob[1] == prob[2]) {
				int m = prob[1] % 4;
				int n = prob[1] / 4 * 2;
				return m == 3 ? n + 1 : n;
			} else if (prob[2] - prob[1] != 1) {
				if (prob[2] % 2 != prob[1] % 2) {
					prob[2] -= 2;
					prob[1]++;
				}
				prob[0] = (prob[2] - prob[1]) / 2;
				prob[2] = prob[1];
				Arrays.sort(prob);
				return solve(prob);
			} else {
				return prob[2] / 2;
			}
		} else {
			int ret = prob[0];
			prob[1] -= prob[0];
			prob[2] -= prob[0];
			prob[0] = 0;
			return ret + solve(prob);
		}
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int r = Integer.parseInt(line[0]);
		int g = Integer.parseInt(line[1]);
		int b = Integer.parseInt(line[2]);
		int[] prob = {r , g , b};
		
		Arrays.sort(prob);
		out(solve(prob));
	}
}
0