結果

問題 No.91 赤、緑、青の石
ユーザー spaciaspacia
提出日時 2016-01-09 16:32:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,116 bytes
コンパイル時間 2,240 ms
コンパイル使用メモリ 78,580 KB
実行使用メモリ 53,772 KB
最終ジャッジ日時 2023-10-19 16:55:57
合計ジャッジ時間 5,061 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
53,752 KB
testcase_01 AC 57 ms
52,672 KB
testcase_02 AC 58 ms
52,760 KB
testcase_03 AC 55 ms
52,660 KB
testcase_04 AC 55 ms
52,704 KB
testcase_05 AC 58 ms
52,740 KB
testcase_06 WA -
testcase_07 AC 55 ms
53,760 KB
testcase_08 AC 56 ms
52,640 KB
testcase_09 AC 56 ms
52,660 KB
testcase_10 AC 55 ms
53,752 KB
testcase_11 AC 55 ms
52,696 KB
testcase_12 AC 57 ms
52,668 KB
testcase_13 AC 55 ms
53,752 KB
testcase_14 AC 57 ms
53,760 KB
testcase_15 AC 57 ms
53,752 KB
testcase_16 AC 56 ms
53,760 KB
testcase_17 AC 56 ms
53,752 KB
testcase_18 AC 56 ms
52,684 KB
testcase_19 AC 56 ms
53,764 KB
testcase_20 AC 58 ms
52,668 KB
testcase_21 WA -
testcase_22 AC 57 ms
52,648 KB
testcase_23 WA -
testcase_24 AC 56 ms
53,764 KB
testcase_25 AC 58 ms
52,756 KB
testcase_26 AC 57 ms
53,764 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 57 ms
53,760 KB
testcase_31 AC 57 ms
52,724 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) {
				int s = (prob[2] - prob[1]);
				prob[2] -= s;
				s /= 2;
				prob[2] -= s;
				prob[1] -= s;
				return s + 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