結果

問題 No.2738 CPC To F
ユーザー 👑 kakel-sankakel-san
提出日時 2024-05-05 22:28:25
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,006 bytes
コンパイル時間 15,799 ms
コンパイル使用メモリ 168,992 KB
実行使用メモリ 187,440 KB
最終ジャッジ日時 2024-05-05 22:28:44
合計ジャッジ時間 15,677 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
28,544 KB
testcase_01 AC 43 ms
28,664 KB
testcase_02 AC 77 ms
41,344 KB
testcase_03 AC 53 ms
35,328 KB
testcase_04 AC 44 ms
28,792 KB
testcase_05 AC 47 ms
29,044 KB
testcase_06 AC 48 ms
28,800 KB
testcase_07 AC 47 ms
28,928 KB
testcase_08 AC 45 ms
29,300 KB
testcase_09 AC 50 ms
31,968 KB
testcase_10 AC 57 ms
29,436 KB
testcase_11 AC 49 ms
32,128 KB
testcase_12 AC 48 ms
32,128 KB
testcase_13 AC 52 ms
32,896 KB
testcase_14 AC 51 ms
33,152 KB
testcase_15 AC 48 ms
33,140 KB
testcase_16 AC 49 ms
33,012 KB
testcase_17 AC 51 ms
32,640 KB
testcase_18 AC 52 ms
33,148 KB
testcase_19 AC 52 ms
33,140 KB
testcase_20 AC 50 ms
32,768 KB
testcase_21 AC 49 ms
32,896 KB
testcase_22 AC 51 ms
33,152 KB
testcase_23 AC 50 ms
187,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (121 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

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

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var s = ReadLine();
        WriteLine(CPC(n, s));
    }
    static int CPC(int n, string s)
    {
        var pos = 0;
        var ans = 0;
        while(pos < n)
        {
            if (pos + 5 <= n && s[pos..(pos+5)] == "CPCTF")
            {
                ++ans;
                pos += 5;
            }
            else if (pos + 7 <= n && s[pos..(pos+7)] == "CPCTCPC")
            {
                ++ans;
                pos += 7;
            }
            else ++pos;
        }
        return ans;
    }
}
0