結果

問題 No.509 塗りつぶしツール
ユーザー GrenacheGrenache
提出日時 2017-05-06 20:03:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 3,384 ms
コンパイル使用メモリ 74,856 KB
実行使用メモリ 58,392 KB
最終ジャッジ日時 2023-10-12 15:13:10
合計ジャッジ時間 8,275 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,888 KB
testcase_01 AC 119 ms
55,668 KB
testcase_02 WA -
testcase_03 AC 120 ms
55,888 KB
testcase_04 WA -
testcase_05 AC 118 ms
55,668 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 120 ms
55,756 KB
testcase_10 AC 116 ms
55,700 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 121 ms
55,828 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 123 ms
55,776 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 121 ms
55,364 KB
testcase_24 AC 120 ms
55,424 KB
testcase_25 AC 121 ms
55,940 KB
testcase_26 WA -
testcase_27 AC 121 ms
55,720 KB
testcase_28 AC 121 ms
55,592 KB
testcase_29 AC 121 ms
55,696 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