結果

問題 No.509 塗りつぶしツール
ユーザー htensaihtensai
提出日時 2019-12-19 14:07:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 72,612 KB
実行使用メモリ 49,856 KB
最終ジャッジ日時 2023-09-21 06:44:29
合計ジャッジ時間 4,558 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,152 KB
testcase_01 AC 44 ms
49,264 KB
testcase_02 AC 44 ms
49,240 KB
testcase_03 AC 43 ms
49,112 KB
testcase_04 AC 44 ms
49,292 KB
testcase_05 AC 43 ms
49,288 KB
testcase_06 AC 44 ms
49,564 KB
testcase_07 AC 43 ms
49,500 KB
testcase_08 AC 44 ms
49,384 KB
testcase_09 AC 43 ms
49,112 KB
testcase_10 AC 45 ms
49,856 KB
testcase_11 AC 43 ms
49,472 KB
testcase_12 AC 45 ms
49,216 KB
testcase_13 AC 46 ms
49,156 KB
testcase_14 AC 44 ms
49,284 KB
testcase_15 AC 44 ms
49,456 KB
testcase_16 AC 44 ms
49,464 KB
testcase_17 AC 45 ms
49,368 KB
testcase_18 AC 45 ms
49,572 KB
testcase_19 AC 44 ms
49,184 KB
testcase_20 AC 44 ms
49,464 KB
testcase_21 AC 44 ms
49,300 KB
testcase_22 AC 43 ms
49,204 KB
testcase_23 AC 44 ms
49,192 KB
testcase_24 AC 44 ms
49,320 KB
testcase_25 AC 44 ms
49,188 KB
testcase_26 AC 44 ms
49,292 KB
testcase_27 AC 45 ms
49,148 KB
testcase_28 AC 44 ms
49,380 KB
testcase_29 AC 43 ms
49,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] arr = br.readLine().toCharArray();
        int[] counts = new int[]{1, 0, 0, 0, 1, 0, 1, 0, 2, 1};
        long total = 0;
        for (char c : arr) {
            total += counts[c - '0'];
        }
        System.out.println(Math.min(arr.length * 2 + total + 1, arr.length + (total + 1) * 2));
    }
}
0