結果

問題 No.509 塗りつぶしツール
ユーザー tentententen
提出日時 2021-05-17 15:35:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,082 bytes
コンパイル時間 2,363 ms
コンパイル使用メモリ 78,144 KB
実行使用メモリ 50,448 KB
最終ジャッジ日時 2024-04-16 04:03:29
合計ジャッジ時間 4,715 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
50,276 KB
testcase_01 AC 54 ms
50,080 KB
testcase_02 AC 52 ms
50,092 KB
testcase_03 AC 52 ms
50,448 KB
testcase_04 AC 54 ms
50,448 KB
testcase_05 AC 52 ms
50,276 KB
testcase_06 AC 54 ms
50,196 KB
testcase_07 AC 54 ms
49,964 KB
testcase_08 AC 54 ms
49,984 KB
testcase_09 AC 54 ms
50,220 KB
testcase_10 AC 54 ms
50,324 KB
testcase_11 AC 57 ms
50,312 KB
testcase_12 AC 54 ms
50,092 KB
testcase_13 AC 53 ms
50,208 KB
testcase_14 AC 54 ms
50,372 KB
testcase_15 AC 53 ms
50,404 KB
testcase_16 AC 54 ms
50,016 KB
testcase_17 AC 53 ms
50,244 KB
testcase_18 AC 53 ms
50,000 KB
testcase_19 AC 53 ms
50,320 KB
testcase_20 AC 52 ms
50,232 KB
testcase_21 AC 53 ms
50,416 KB
testcase_22 AC 53 ms
50,320 KB
testcase_23 AC 56 ms
50,016 KB
testcase_24 AC 53 ms
50,120 KB
testcase_25 AC 52 ms
50,352 KB
testcase_26 AC 54 ms
49,816 KB
testcase_27 AC 55 ms
50,284 KB
testcase_28 AC 53 ms
49,800 KB
testcase_29 AC 52 ms
50,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int[] holes = new int[]{1, 0, 0, 0, 1, 0, 1, 0, 2, 1};
        int line = 0;
        int inside = 0;
        for (char c : sc.next().toCharArray()) {
            line++;
            inside += holes[c - '0'];
        }
        int min = Math.min(line * 2 + inside + 1, (1 + inside) * 2 + line);
        System.out.println(min);
    }
}

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0