結果

問題 No.2541 Divide 01 String
ユーザー heno239heno239
提出日時 2024-02-05 17:48:00
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 862 bytes
コンパイル時間 6,879 ms
コンパイル使用メモリ 158,744 KB
実行使用メモリ 179,356 KB
最終ジャッジ日時 2024-02-05 17:48:10
合計ジャッジ時間 9,542 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
31,012 KB
testcase_01 AC 55 ms
31,012 KB
testcase_02 AC 58 ms
31,012 KB
testcase_03 AC 56 ms
31,396 KB
testcase_04 AC 59 ms
31,652 KB
testcase_05 AC 59 ms
32,036 KB
testcase_06 AC 58 ms
31,652 KB
testcase_07 AC 58 ms
32,036 KB
testcase_08 AC 59 ms
32,036 KB
testcase_09 AC 59 ms
32,036 KB
testcase_10 AC 58 ms
32,036 KB
testcase_11 AC 57 ms
32,036 KB
testcase_12 AC 58 ms
32,036 KB
testcase_13 AC 56 ms
31,012 KB
testcase_14 AC 56 ms
31,012 KB
testcase_15 AC 55 ms
31,012 KB
testcase_16 AC 56 ms
31,012 KB
testcase_17 AC 56 ms
31,012 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (124 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System.Collections;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

internal class Program
{
    private const long mod = 998244353;

    
    public static void Main(string[] args)
    {
        long ans = 1;
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        int le = 0;

        void upd(int c)
        {
            ans = ans * (c + 2) % mod;
        }

        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == '1')
            {
                if (le > 0) upd(i - le);
                le = i + 1;
            }
        }

        Console.WriteLine(ans);
    }

    public static List<int> mkar(int n, int val)
    {
        List<int> res = new List<int>(n);
        for(int i=0;i<n;i++)res.Add(val);
        return res;
    }
}
0