結果

問題 No.509 塗りつぶしツール
ユーザー samplelpmassamplelpmas
提出日時 2017-05-02 17:06:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 4,249 ms
コンパイル使用メモリ 72,304 KB
実行使用メモリ 57,344 KB
最終ジャッジ日時 2023-10-12 05:12:26
合計ジャッジ時間 9,520 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,564 KB
testcase_01 AC 122 ms
55,368 KB
testcase_02 AC 121 ms
55,716 KB
testcase_03 AC 122 ms
55,532 KB
testcase_04 AC 122 ms
55,512 KB
testcase_05 AC 124 ms
55,384 KB
testcase_06 AC 124 ms
55,568 KB
testcase_07 AC 121 ms
55,624 KB
testcase_08 AC 121 ms
55,560 KB
testcase_09 AC 121 ms
55,468 KB
testcase_10 AC 122 ms
55,628 KB
testcase_11 AC 122 ms
55,532 KB
testcase_12 AC 122 ms
53,376 KB
testcase_13 AC 123 ms
55,692 KB
testcase_14 AC 122 ms
55,588 KB
testcase_15 AC 122 ms
55,684 KB
testcase_16 AC 121 ms
55,552 KB
testcase_17 AC 121 ms
55,384 KB
testcase_18 AC 123 ms
55,488 KB
testcase_19 AC 120 ms
55,736 KB
testcase_20 AC 120 ms
55,720 KB
testcase_21 AC 122 ms
57,344 KB
testcase_22 AC 122 ms
55,380 KB
testcase_23 AC 121 ms
55,688 KB
testcase_24 AC 123 ms
55,624 KB
testcase_25 AC 122 ms
55,684 KB
testcase_26 AC 122 ms
55,584 KB
testcase_27 AC 120 ms
55,540 KB
testcase_28 AC 120 ms
55,628 KB
testcase_29 AC 120 ms
55,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        char[] nums = sc.next().toCharArray();

        int holesCount = 0;

        for (int i = 0; i < nums.length; i++) {

            int num = nums[i];

            if (num == '0' || num == '4' || num == '6' || num == '9') {
                holesCount++;
            }

            if (num == '8') {
                holesCount += 2;
            }

        }

        int min = Math.min(2 * nums.length + holesCount + 1, 2 * (holesCount + 1) + nums.length);

        System.out.println(min);

    }

}
0