結果

問題 No.91 赤、緑、青の石
ユーザー yy
提出日時 2016-03-17 22:29:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 1,049 bytes
コンパイル時間 2,019 ms
コンパイル使用メモリ 74,504 KB
実行使用メモリ 51,412 KB
最終ジャッジ日時 2023-09-06 12:19:52
合計ジャッジ時間 5,125 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
50,972 KB
testcase_01 AC 71 ms
50,352 KB
testcase_02 AC 68 ms
51,044 KB
testcase_03 AC 75 ms
50,508 KB
testcase_04 AC 66 ms
51,412 KB
testcase_05 AC 86 ms
50,968 KB
testcase_06 AC 78 ms
50,892 KB
testcase_07 AC 41 ms
49,192 KB
testcase_08 AC 42 ms
49,280 KB
testcase_09 AC 40 ms
49,580 KB
testcase_10 AC 39 ms
49,296 KB
testcase_11 AC 64 ms
50,376 KB
testcase_12 AC 82 ms
51,028 KB
testcase_13 AC 76 ms
51,008 KB
testcase_14 AC 79 ms
50,892 KB
testcase_15 AC 73 ms
51,356 KB
testcase_16 AC 40 ms
49,324 KB
testcase_17 AC 43 ms
49,344 KB
testcase_18 AC 42 ms
47,536 KB
testcase_19 AC 42 ms
49,404 KB
testcase_20 AC 44 ms
49,192 KB
testcase_21 AC 45 ms
49,384 KB
testcase_22 AC 45 ms
49,300 KB
testcase_23 AC 45 ms
49,256 KB
testcase_24 AC 45 ms
49,440 KB
testcase_25 AC 89 ms
51,004 KB
testcase_26 AC 84 ms
50,988 KB
testcase_27 AC 46 ms
49,408 KB
testcase_28 AC 67 ms
51,000 KB
testcase_29 AC 70 ms
51,256 KB
testcase_30 AC 80 ms
50,348 KB
testcase_31 AC 83 ms
50,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int[] n = new int[3];
        for (int i = 0; i < 3; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        while (true) {
            int max = 0;
            int maxi = 0;
            int min = Integer.MAX_VALUE;
            int mini = 0;
            for (int i = 0; i < 3; i++) {
                if (max < n[i]) {
                    max = n[i];
                    maxi = i;
                }
                if (min > n[i]) {
                    min = n[i];
                    mini = i;
                }
            }
            if (max - min < 2) break;
            n[maxi] -= 2;
            n[mini]++;
        }
        System.out.println(Math.min(Math.min(n[0], n[1]), n[2]));
    }
}
0