結果

問題 No.509 塗りつぶしツール
ユーザー GrenacheGrenache
提出日時 2017-05-06 19:51:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 972 bytes
コンパイル時間 6,681 ms
コンパイル使用メモリ 74,200 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-10-12 15:12:32
合計ジャッジ時間 9,285 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,312 KB
testcase_01 AC 116 ms
55,676 KB
testcase_02 AC 116 ms
55,652 KB
testcase_03 WA -
testcase_04 AC 117 ms
55,412 KB
testcase_05 AC 118 ms
55,936 KB
testcase_06 WA -
testcase_07 AC 120 ms
55,724 KB
testcase_08 AC 115 ms
54,568 KB
testcase_09 AC 116 ms
56,152 KB
testcase_10 AC 115 ms
55,628 KB
testcase_11 AC 118 ms
55,760 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 115 ms
55,620 KB
testcase_15 AC 115 ms
56,036 KB
testcase_16 WA -
testcase_17 AC 115 ms
55,344 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 116 ms
55,836 KB
testcase_23 AC 113 ms
55,748 KB
testcase_24 WA -
testcase_25 AC 111 ms
55,864 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 116 ms
55,652 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] * 2 + 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