結果

問題 No.509 塗りつぶしツール
ユーザー takeya_okinotakeya_okino
提出日時 2017-09-30 20:11:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 74,920 KB
実行使用メモリ 41,612 KB
最終ジャッジ日時 2024-04-27 16:59:06
合計ジャッジ時間 5,938 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
41,612 KB
testcase_01 AC 112 ms
40,876 KB
testcase_02 AC 102 ms
40,028 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 107 ms
41,148 KB
testcase_07 WA -
testcase_08 AC 96 ms
39,804 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 91 ms
39,468 KB
testcase_15 WA -
testcase_16 AC 104 ms
41,408 KB
testcase_17 WA -
testcase_18 AC 108 ms
41,256 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 99 ms
40,292 KB
testcase_23 AC 100 ms
40,080 KB
testcase_24 AC 110 ms
41,400 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 99 ms
40,076 KB
testcase_28 AC 113 ms
41,484 KB
testcase_29 AC 110 ms
41,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] num = new int[10];
    int r = 0;
    for(int i = 0; i < 10; i++) {
      int d = n % 10;
      num[d]++;
      r++;
      n /= 10;
      if(n == 0) break;
    }
    int ans = 2 * r + 1;
    for(int i = 0; i < 10; i++) {
      if((i == 0) || (i == 4) || (i == 6) || (i == 9)) ans += (num[i]);
      if(i == 8) ans += (2 * num[i]);
    }
    System.out.println(ans);
  }
}
0