結果

問題 No.509 塗りつぶしツール
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-16 15:42:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 3,837 ms
コンパイル使用メモリ 73,344 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2023-09-02 10:38:01
合計ジャッジ時間 8,512 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,692 KB
testcase_01 AC 122 ms
55,872 KB
testcase_02 AC 121 ms
55,692 KB
testcase_03 AC 123 ms
55,916 KB
testcase_04 AC 121 ms
55,736 KB
testcase_05 AC 123 ms
55,972 KB
testcase_06 AC 123 ms
55,700 KB
testcase_07 AC 122 ms
56,024 KB
testcase_08 AC 124 ms
55,804 KB
testcase_09 AC 125 ms
55,592 KB
testcase_10 AC 123 ms
56,000 KB
testcase_11 AC 124 ms
55,612 KB
testcase_12 AC 122 ms
55,364 KB
testcase_13 AC 124 ms
55,792 KB
testcase_14 AC 123 ms
55,768 KB
testcase_15 AC 123 ms
55,460 KB
testcase_16 AC 124 ms
55,840 KB
testcase_17 AC 124 ms
55,356 KB
testcase_18 AC 125 ms
55,624 KB
testcase_19 AC 123 ms
55,612 KB
testcase_20 AC 123 ms
55,592 KB
testcase_21 AC 122 ms
55,632 KB
testcase_22 AC 121 ms
55,644 KB
testcase_23 AC 123 ms
55,840 KB
testcase_24 AC 123 ms
55,564 KB
testcase_25 AC 124 ms
55,464 KB
testcase_26 AC 122 ms
55,836 KB
testcase_27 AC 124 ms
55,976 KB
testcase_28 AC 123 ms
55,616 KB
testcase_29 AC 123 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No509 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String n[] = N.split("");
		int ana = 0;
		int x[] = new int[n.length];
		for(int i = 0;i < n.length;i++) {
			x[i] = Integer.parseInt(n[i]);
		}
		for(int i = 0;i < n.length;i++) {
			switch(x[i]) {
			case 1:
			case 2:
			case 3:
			case 5:
			case 7:
				break;
			case 0:
			case 4:
			case 6:
			case 9:
				ana += 1;
				break;
			case 8:
				ana += 2;
			}
		}
		System.out.println(Math.min(2*n.length + ana + 1, 2*(ana + 1) + n.length));
	}
}
0