結果

問題 No.91 赤、緑、青の石
ユーザー tentententen
提出日時 2020-11-17 16:50:38
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 2,004 ms
コンパイル使用メモリ 72,468 KB
実行使用メモリ 58,036 KB
最終ジャッジ日時 2023-09-30 14:18:38
合計ジャッジ時間 7,755 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 126 ms
55,808 KB
testcase_07 AC 123 ms
55,668 KB
testcase_08 AC 124 ms
55,724 KB
testcase_09 AC 125 ms
55,524 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 125 ms
55,828 KB
testcase_17 AC 125 ms
56,056 KB
testcase_18 AC 127 ms
55,688 KB
testcase_19 WA -
testcase_20 AC 123 ms
56,036 KB
testcase_21 AC 123 ms
56,436 KB
testcase_22 AC 123 ms
56,152 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 124 ms
55,468 KB
testcase_28 AC 123 ms
55,824 KB
testcase_29 AC 123 ms
56,112 KB
testcase_30 AC 122 ms
54,528 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[3];
        for (int i = 0; i < 3; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int ans = arr[0];
        arr[2] -= arr[0];
        arr[1] -= arr[0];
        arr[0] = 0;
        if (arr[1] > 0) {
            int add = Math.min(arr[1], arr[2] / 3);
            ans += add;
            arr[1] -= add;
            arr[2] -= add * 3;
        }
        ans += arr[2] / 5;
        System.out.println(ans);
    }
}
0