結果

問題 No.509 塗りつぶしツール
ユーザー akitsu818
提出日時 2017-04-29 00:30:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 2,298 ms
コンパイル使用メモリ 74,524 KB
実行使用メモリ 54,500 KB
最終ジャッジ日時 2024-09-13 19:39:52
合計ジャッジ時間 6,928 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner cin = new Scanner(System.in);

		String line = cin.next();
		int count = line.length();
		int zero_count = 0;
		int eight_count =0;
		char tmp;
		int result;

		for(int i=0;i<count;i++){
			tmp = line.charAt(i);
			if(tmp == '0'||tmp=='4'||tmp=='6'||tmp=='9'){
				zero_count++;
			}else if(tmp == '8'){
				zero_count+=2;
				eight_count++;
			}
		}
		result = Math.min(2*count+1+zero_count,2+count+zero_count*2);
		
		System.out.println(result);
	}
}
0