結果

問題 No.509 塗りつぶしツール
ユーザー GrenacheGrenache
提出日時 2017-05-06 20:06:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 970 bytes
コンパイル時間 3,473 ms
コンパイル使用メモリ 74,888 KB
実行使用メモリ 56,300 KB
最終ジャッジ日時 2023-10-12 15:13:34
合計ジャッジ時間 8,200 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
56,300 KB
testcase_01 AC 115 ms
55,780 KB
testcase_02 AC 116 ms
55,868 KB
testcase_03 AC 113 ms
56,204 KB
testcase_04 AC 111 ms
56,068 KB
testcase_05 AC 121 ms
55,416 KB
testcase_06 AC 120 ms
55,924 KB
testcase_07 AC 118 ms
55,912 KB
testcase_08 AC 119 ms
56,012 KB
testcase_09 AC 117 ms
55,836 KB
testcase_10 AC 115 ms
55,664 KB
testcase_11 AC 121 ms
55,480 KB
testcase_12 AC 115 ms
55,564 KB
testcase_13 AC 115 ms
56,108 KB
testcase_14 AC 115 ms
56,000 KB
testcase_15 AC 116 ms
55,676 KB
testcase_16 AC 118 ms
56,088 KB
testcase_17 AC 117 ms
56,044 KB
testcase_18 AC 119 ms
55,876 KB
testcase_19 AC 118 ms
55,420 KB
testcase_20 AC 117 ms
55,940 KB
testcase_21 AC 119 ms
56,220 KB
testcase_22 AC 119 ms
56,184 KB
testcase_23 AC 115 ms
55,964 KB
testcase_24 AC 118 ms
55,684 KB
testcase_25 AC 121 ms
55,868 KB
testcase_26 AC 119 ms
56,016 KB
testcase_27 AC 117 ms
55,476 KB
testcase_28 AC 115 ms
55,592 KB
testcase_29 AC 118 ms
55,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder509 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] n = sc.next().toCharArray();

		int[] cnt = new int[10];
		for (char c : n) {
			cnt[c - '0']++;
		}

		int b = 1;
		int o = cnt[0] + cnt[4] + cnt[6] + cnt[8] * 2 + cnt[9];
		int g1 = cnt[1] + cnt[2] + cnt[3] + cnt[5] + cnt[7];
		int g2 = cnt[0] + cnt[4] + cnt[6] + cnt[8] + cnt[9];

		int min = Integer.MAX_VALUE;
		min = Math.min(min, g1 + g2 + o + b + g1 + g2);
		min = Math.min(min, b + o + g1 + g2 + o + b);
//		min = Math.min(min, g2 + o + b + g1 + g2 + b);

		pr.println(min);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0