結果

問題 No.910 素数部分列
ユーザー tentententen
提出日時 2020-08-26 20:42:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 1,770 ms
コンパイル使用メモリ 73,972 KB
実行使用メモリ 43,788 KB
最終ジャッジ日時 2024-04-25 03:45:35
合計ジャッジ時間 11,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
40,048 KB
testcase_01 AC 111 ms
41,112 KB
testcase_02 AC 105 ms
39,944 KB
testcase_03 AC 95 ms
40,040 KB
testcase_04 AC 99 ms
40,084 KB
testcase_05 AC 111 ms
41,424 KB
testcase_06 AC 109 ms
41,244 KB
testcase_07 AC 107 ms
40,980 KB
testcase_08 AC 97 ms
40,304 KB
testcase_09 AC 111 ms
41,104 KB
testcase_10 AC 115 ms
40,776 KB
testcase_11 AC 112 ms
40,956 KB
testcase_12 AC 115 ms
41,456 KB
testcase_13 WA -
testcase_14 AC 109 ms
40,976 KB
testcase_15 WA -
testcase_16 AC 115 ms
41,192 KB
testcase_17 WA -
testcase_18 AC 98 ms
40,160 KB
testcase_19 AC 117 ms
41,300 KB
testcase_20 WA -
testcase_21 AC 100 ms
39,952 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 192 ms
43,060 KB
testcase_44 AC 190 ms
43,400 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 192 ms
43,232 KB
testcase_49 AC 181 ms
42,864 KB
testcase_50 AC 186 ms
43,160 KB
testcase_51 AC 182 ms
43,300 KB
testcase_52 AC 185 ms
43,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
        int one = 0;
        int nine = 0;
        for (char c : arr) {
            if (c == '1') {
                one++;
            } else if (c == '9') {
                if (one > 0) {
                    count++;
                    one--;
                }
            } else {
                count++;
            }
        }
         count += one / 2;
        System.out.println(count);
    }
}
0