結果

問題 No.509 塗りつぶしツール
ユーザー YamaKasaYamaKasa
提出日時 2018-09-24 16:29:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 3,772 ms
コンパイル使用メモリ 73,864 KB
実行使用メモリ 41,176 KB
最終ジャッジ日時 2023-10-22 05:04:33
合計ジャッジ時間 7,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
40,716 KB
testcase_01 AC 119 ms
40,732 KB
testcase_02 AC 109 ms
39,724 KB
testcase_03 AC 122 ms
41,128 KB
testcase_04 AC 123 ms
40,932 KB
testcase_05 AC 109 ms
39,732 KB
testcase_06 AC 121 ms
40,864 KB
testcase_07 AC 124 ms
41,024 KB
testcase_08 AC 122 ms
40,708 KB
testcase_09 AC 123 ms
41,176 KB
testcase_10 AC 109 ms
39,724 KB
testcase_11 AC 121 ms
40,840 KB
testcase_12 AC 109 ms
39,728 KB
testcase_13 AC 108 ms
39,732 KB
testcase_14 AC 120 ms
40,988 KB
testcase_15 AC 123 ms
40,964 KB
testcase_16 AC 119 ms
41,000 KB
testcase_17 AC 119 ms
40,864 KB
testcase_18 AC 119 ms
40,724 KB
testcase_19 AC 121 ms
40,800 KB
testcase_20 AC 119 ms
40,756 KB
testcase_21 AC 119 ms
41,128 KB
testcase_22 AC 108 ms
39,732 KB
testcase_23 AC 119 ms
40,748 KB
testcase_24 AC 122 ms
41,032 KB
testcase_25 AC 119 ms
40,776 KB
testcase_26 AC 108 ms
39,728 KB
testcase_27 AC 119 ms
41,048 KB
testcase_28 AC 120 ms
40,712 KB
testcase_29 AC 118 ms
40,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int l = s.length();
		int k1 = 0;
		for(int i = 0; i < l; i++) {
			char c = s.charAt(i);
			if(c == '1' || c == '2' || c == '3' || c == '5' || c == '7') {
				continue;
			}else if(c == '4' || c == '6' || c == '9' || c == '0') {
				k1++;
			}else {
				k1 += 2;
			}
		}
		int min = Math.min(2 * l + k1 + 1, 2 * (k1 + 1) + l);
		System.out.println(min);
	}
}
0