結果
問題 |
No.509 塗りつぶしツール
|
ユーザー |
![]() |
提出日時 | 2018-03-06 14:46:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 1,794 ms |
コンパイル使用メモリ | 75,256 KB |
実行使用メモリ | 41,528 KB |
最終ジャッジ日時 | 2024-09-18 22:36:47 |
合計ジャッジ時間 | 5,984 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
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)); } }