結果
問題 | No.910 素数部分列 |
ユーザー | htensai |
提出日時 | 2019-11-11 09:14:24 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,083 bytes |
コンパイル時間 | 2,751 ms |
コンパイル使用メモリ | 74,684 KB |
実行使用メモリ | 63,408 KB |
最終ジャッジ日時 | 2023-10-13 07:58:05 |
合計ジャッジ時間 | 17,695 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 116 ms
55,708 KB |
testcase_01 | AC | 108 ms
56,180 KB |
testcase_02 | AC | 108 ms
55,840 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 112 ms
55,428 KB |
testcase_06 | AC | 107 ms
55,800 KB |
testcase_07 | AC | 110 ms
55,672 KB |
testcase_08 | AC | 112 ms
56,304 KB |
testcase_09 | AC | 111 ms
55,864 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 112 ms
55,624 KB |
testcase_13 | AC | 110 ms
55,684 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 108 ms
55,652 KB |
testcase_17 | AC | 111 ms
55,880 KB |
testcase_18 | WA | - |
testcase_19 | AC | 115 ms
56,368 KB |
testcase_20 | AC | 111 ms
56,328 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 216 ms
58,696 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 261 ms
61,048 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 286 ms
61,620 KB |
testcase_36 | AC | 287 ms
61,428 KB |
testcase_37 | AC | 274 ms
62,088 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | AC | 249 ms
59,352 KB |
testcase_43 | AC | 248 ms
59,144 KB |
testcase_44 | AC | 246 ms
58,680 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 195 ms
58,580 KB |
testcase_49 | TLE | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] arr = sc.next().toCharArray(); int[] counts = new int[10]; StringBuilder sb = new StringBuilder(); for (char c : arr) { counts[c - '0']++; if (c == '1' || c == '9') { sb.append(c); } } int total = counts[3] + counts[5] + counts[7]; HashSet<Integer> set = new HashSet<>(); for (int i = 0; i < sb.length(); i++) { if (sb.charAt(i) == '9' || set.contains(i)) { continue; } boolean flag = false; for (int j = i + 1; j < sb.length(); j++) { if (sb.charAt(j) == '9') { flag = true; set.add(j); total++; break; } } if (flag) { continue; } for (int j = i + 1; j < sb.length(); j++) { if (sb.charAt(j) == '1') { set.add(j); total++; break; } } } System.out.println(total); } }