結果

問題 No.910 素数部分列
ユーザー iwkjoseciwkjosec
提出日時 2019-10-18 22:33:22
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,045 bytes
コンパイル時間 4,096 ms
コンパイル使用メモリ 101,904 KB
実行使用メモリ 26,832 KB
最終ジャッジ日時 2023-09-08 00:26:43
合計ジャッジ時間 7,638 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
22,752 KB
testcase_01 AC 53 ms
20,888 KB
testcase_02 AC 53 ms
22,676 KB
testcase_03 AC 54 ms
22,744 KB
testcase_04 AC 53 ms
20,816 KB
testcase_05 AC 55 ms
18,724 KB
testcase_06 AC 55 ms
20,696 KB
testcase_07 AC 54 ms
20,712 KB
testcase_08 AC 54 ms
20,640 KB
testcase_09 AC 54 ms
20,828 KB
testcase_10 AC 54 ms
22,752 KB
testcase_11 AC 54 ms
22,836 KB
testcase_12 AC 53 ms
20,840 KB
testcase_13 WA -
testcase_14 AC 54 ms
20,820 KB
testcase_15 WA -
testcase_16 AC 54 ms
20,764 KB
testcase_17 WA -
testcase_18 AC 54 ms
22,804 KB
testcase_19 AC 54 ms
22,744 KB
testcase_20 WA -
testcase_21 AC 54 ms
20,696 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 63 ms
22,772 KB
testcase_44 AC 64 ms
22,892 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 62 ms
22,956 KB
testcase_49 AC 61 ms
22,808 KB
testcase_50 AC 62 ms
22,760 KB
testcase_51 AC 56 ms
20,928 KB
testcase_52 AC 62 ms
24,860 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var S = ReadLine();
        var ans = 0;
        var s = new List<int>();
        for (int i = 0; i < N; i++)
        {
            var n = S[i] - '0';
            if (n == 3 || n == 5 || n == 7) ans++;
            else s.Add(n);
        }
        var c = 0;
        var m = 0;
        for (int i = 0; i < s.Count; i++)
        {
            if (s[i] == 1)
            {
                c++;
            }
            else
            {
                c--;
                m++;
            }
            if (c < 0)
            {
                m--;
                c = 0;
            }
        }
        ans += m;
        var k = 0;
        for (int i = 0; i < s.Count; i++)
        {
            if (s[i] == 1) k++;
        }
        k = Max(k - m, 0)/2;
        ans += k;
        WriteLine(ans);
    }
}
0