結果

問題 No.509 塗りつぶしツール
ユーザー YamaKasa
提出日時 2018-09-24 16:22:46
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 534 bytes
コンパイル時間 2,035 ms
コンパイル使用メモリ 75,084 KB
実行使用メモリ 56,084 KB
最終ジャッジ日時 2024-09-22 06:05:59
合計ジャッジ時間 6,702 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 16
権限があれば一括ダウンロードができます

ソースコード

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 * (l + k1) + l);
		System.out.println(min);
	}
}
0