結果
問題 | No.910 素数部分列 |
ユーザー | htensai |
提出日時 | 2020-01-07 11:17:27 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 896 bytes |
コンパイル時間 | 3,067 ms |
コンパイル使用メモリ | 75,464 KB |
実行使用メモリ | 46,780 KB |
最終ジャッジ日時 | 2024-05-02 11:18:17 |
合計ジャッジ時間 | 15,719 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 130 ms
41,036 KB |
testcase_01 | AC | 131 ms
41,104 KB |
testcase_02 | AC | 131 ms
40,936 KB |
testcase_03 | AC | 130 ms
41,068 KB |
testcase_04 | AC | 131 ms
41,268 KB |
testcase_05 | AC | 131 ms
40,836 KB |
testcase_06 | AC | 129 ms
41,096 KB |
testcase_07 | AC | 118 ms
40,272 KB |
testcase_08 | AC | 128 ms
41,208 KB |
testcase_09 | AC | 130 ms
41,092 KB |
testcase_10 | AC | 134 ms
41,080 KB |
testcase_11 | AC | 132 ms
41,308 KB |
testcase_12 | AC | 134 ms
40,792 KB |
testcase_13 | WA | - |
testcase_14 | AC | 129 ms
41,160 KB |
testcase_15 | WA | - |
testcase_16 | AC | 132 ms
41,168 KB |
testcase_17 | WA | - |
testcase_18 | AC | 130 ms
41,076 KB |
testcase_19 | AC | 129 ms
40,940 KB |
testcase_20 | WA | - |
testcase_21 | AC | 131 ms
41,100 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 248 ms
45,852 KB |
testcase_44 | AC | 248 ms
45,684 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 239 ms
46,112 KB |
testcase_49 | AC | 248 ms
45,916 KB |
testcase_50 | AC | 247 ms
46,184 KB |
testcase_51 | AC | 213 ms
43,168 KB |
testcase_52 | AC | 245 ms
46,032 KB |
ソースコード
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 count = 0; ArrayList<Integer> list = new ArrayList<>(); for (char c : arr) { if (c == '3' || c == '5' || c == '7') { count++; } else { list.add(c - '0'); } } int oneCount = 0; int nineCount = 0; for (int x : list) { if (x == 1) { oneCount++; } else { if (oneCount > 0) { count++; oneCount--; } else { nineCount++; } } } count += oneCount / 2; System.out.println(count); } }