結果

問題 No.509 塗りつぶしツール
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-03-06 14:46:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 2,942 ms
コンパイル使用メモリ 74,496 KB
実行使用メモリ 57,472 KB
最終ジャッジ日時 2023-10-19 02:37:17
合計ジャッジ時間 8,470 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
57,240 KB
testcase_01 AC 129 ms
57,296 KB
testcase_02 AC 127 ms
57,140 KB
testcase_03 AC 126 ms
57,020 KB
testcase_04 AC 128 ms
57,440 KB
testcase_05 AC 126 ms
57,252 KB
testcase_06 AC 130 ms
57,216 KB
testcase_07 AC 129 ms
57,308 KB
testcase_08 AC 128 ms
57,336 KB
testcase_09 AC 128 ms
57,468 KB
testcase_10 AC 127 ms
57,232 KB
testcase_11 AC 129 ms
57,344 KB
testcase_12 AC 129 ms
57,240 KB
testcase_13 AC 128 ms
56,972 KB
testcase_14 AC 128 ms
57,308 KB
testcase_15 AC 133 ms
57,472 KB
testcase_16 AC 128 ms
57,236 KB
testcase_17 AC 127 ms
57,304 KB
testcase_18 AC 129 ms
57,304 KB
testcase_19 AC 127 ms
57,252 KB
testcase_20 AC 128 ms
57,268 KB
testcase_21 AC 130 ms
57,188 KB
testcase_22 AC 131 ms
57,276 KB
testcase_23 AC 131 ms
57,300 KB
testcase_24 AC 126 ms
56,984 KB
testcase_25 AC 126 ms
57,376 KB
testcase_26 AC 130 ms
57,156 KB
testcase_27 AC 127 ms
57,268 KB
testcase_28 AC 128 ms
57,308 KB
testcase_29 AC 128 ms
57,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		long leng = s.length();
		long num = 0;
		char c;
		for (int i=0; i<s.length(); i++) {
			c = s.charAt(i);
			if (c=='8') {num+=2;}
			else if (c=='0' || c=='4' || c=='6' || c=='9') {num++;}
		}
		out.println(Math.min(2*leng+num+1,2*(num+1)+leng));
	}
}
0