結果

問題 No.91 赤、緑、青の石
ユーザー GrenacheGrenache
提出日時 2015-11-22 23:47:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 943 bytes
コンパイル時間 4,668 ms
コンパイル使用メモリ 72,248 KB
実行使用メモリ 40,028 KB
最終ジャッジ日時 2023-10-11 18:16:50
合計ジャッジ時間 9,954 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
39,516 KB
testcase_01 AC 123 ms
39,448 KB
testcase_02 AC 123 ms
39,568 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 122 ms
39,488 KB
testcase_07 AC 123 ms
39,680 KB
testcase_08 AC 124 ms
39,416 KB
testcase_09 AC 124 ms
39,232 KB
testcase_10 AC 122 ms
39,596 KB
testcase_11 AC 123 ms
39,240 KB
testcase_12 AC 125 ms
39,840 KB
testcase_13 AC 123 ms
39,400 KB
testcase_14 AC 123 ms
39,820 KB
testcase_15 AC 122 ms
39,452 KB
testcase_16 AC 121 ms
39,652 KB
testcase_17 AC 123 ms
39,396 KB
testcase_18 AC 123 ms
39,752 KB
testcase_19 AC 122 ms
39,288 KB
testcase_20 AC 121 ms
39,512 KB
testcase_21 AC 123 ms
39,596 KB
testcase_22 AC 123 ms
39,440 KB
testcase_23 AC 123 ms
39,528 KB
testcase_24 AC 123 ms
39,504 KB
testcase_25 AC 124 ms
40,028 KB
testcase_26 WA -
testcase_27 AC 124 ms
39,356 KB
testcase_28 AC 124 ms
39,356 KB
testcase_29 AC 121 ms
39,848 KB
testcase_30 AC 123 ms
39,616 KB
testcase_31 AC 124 ms
39,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;


public class Main_yukicoder91 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] rgb = new int[3];
        for (int i = 0; i < 3; i++) {
        	rgb[i] = sc.nextInt();
        }
        Arrays.sort(rgb);

        int l = 0;
        int r = 10_000_001;
		while (r > l) {
        	int mid = (r + l) / 2;
        	int value = 0;
        	int value2 = 0;
        	for (int i = 0; i < 3; i++) {
        		if (rgb[i] >= 10_000_000 - mid) {
        			int tmp = rgb[i] - (10_000_000 - mid);
        			if (tmp > 1) {
        				value += tmp;
        			}
        		} else {
        			value2 += (10_000_000 - mid) - rgb[i];
        		}
        	}
        	if (value >= value2 * 2) {
        		r = mid;
        	} else {
        		l = mid + 1;
        	}
        }

        System.out.println(10_000_000 - r);

        sc.close();
    }
}
0