結果

問題 No.509 塗りつぶしツール
ユーザー akitsu818akitsu818
提出日時 2017-04-29 00:30:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 72,104 KB
実行使用メモリ 57,500 KB
最終ジャッジ日時 2023-10-11 20:49:26
合計ジャッジ時間 7,118 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,432 KB
testcase_01 AC 118 ms
55,812 KB
testcase_02 AC 119 ms
55,800 KB
testcase_03 AC 121 ms
55,384 KB
testcase_04 AC 121 ms
55,588 KB
testcase_05 AC 120 ms
55,924 KB
testcase_06 AC 121 ms
55,820 KB
testcase_07 AC 119 ms
55,636 KB
testcase_08 AC 119 ms
55,588 KB
testcase_09 AC 119 ms
55,800 KB
testcase_10 AC 119 ms
57,500 KB
testcase_11 AC 119 ms
55,664 KB
testcase_12 AC 119 ms
55,760 KB
testcase_13 AC 118 ms
55,668 KB
testcase_14 AC 117 ms
55,696 KB
testcase_15 AC 118 ms
55,836 KB
testcase_16 AC 118 ms
55,488 KB
testcase_17 AC 117 ms
55,400 KB
testcase_18 AC 120 ms
56,196 KB
testcase_19 AC 118 ms
55,840 KB
testcase_20 AC 116 ms
55,788 KB
testcase_21 AC 117 ms
55,676 KB
testcase_22 AC 120 ms
55,832 KB
testcase_23 AC 121 ms
55,724 KB
testcase_24 AC 121 ms
55,844 KB
testcase_25 AC 120 ms
56,056 KB
testcase_26 AC 119 ms
56,100 KB
testcase_27 AC 119 ms
55,696 KB
testcase_28 AC 118 ms
55,900 KB
testcase_29 AC 119 ms
55,824 KB
権限があれば一括ダウンロードができます

ソースコード

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