結果

問題 No.509 塗りつぶしツール
ユーザー shinwisteriashinwisteria
提出日時 2017-05-04 22:20:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 3,120 ms
コンパイル使用メモリ 72,336 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2023-10-12 08:10:43
合計ジャッジ時間 7,760 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,040 KB
testcase_01 AC 115 ms
55,488 KB
testcase_02 AC 116 ms
55,632 KB
testcase_03 AC 115 ms
55,828 KB
testcase_04 AC 115 ms
55,732 KB
testcase_05 AC 114 ms
55,344 KB
testcase_06 AC 116 ms
55,680 KB
testcase_07 AC 115 ms
55,596 KB
testcase_08 AC 115 ms
55,792 KB
testcase_09 AC 115 ms
55,800 KB
testcase_10 AC 116 ms
55,676 KB
testcase_11 AC 116 ms
55,780 KB
testcase_12 AC 115 ms
55,488 KB
testcase_13 AC 116 ms
56,132 KB
testcase_14 AC 113 ms
55,856 KB
testcase_15 AC 114 ms
55,780 KB
testcase_16 AC 115 ms
55,684 KB
testcase_17 AC 113 ms
55,976 KB
testcase_18 AC 113 ms
55,832 KB
testcase_19 AC 114 ms
55,676 KB
testcase_20 AC 115 ms
55,984 KB
testcase_21 AC 113 ms
55,792 KB
testcase_22 AC 114 ms
55,684 KB
testcase_23 AC 113 ms
55,944 KB
testcase_24 AC 114 ms
55,488 KB
testcase_25 AC 115 ms
55,788 KB
testcase_26 AC 114 ms
55,648 KB
testcase_27 AC 114 ms
55,684 KB
testcase_28 AC 114 ms
55,676 KB
testcase_29 AC 115 ms
55,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Nuritsubushi {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder n = new StringBuilder(s.next());
		s.close();
		int a = 0,b = 0,c = 0,count = 0;
		while(n.length() != 0){
			char ch = n.charAt(0);
			n.deleteCharAt(0);
			if(ch == '8'){
				c++;
			}else if(ch == '0' || ch == '4' || ch == '6' || ch == '9'){
				b++;
			}else{
				a++;
			}
		}
		count = a*2 + b*3 + c*4 + 1;
		count = Math.min(count, a + b*3 + c*5 + 2);
		System.out.println(count);
	}

}
0