結果

問題 No.2738 CPC To F
ユーザー bluemeganebluemegane
提出日時 2024-04-23 13:09:32
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 1,771 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 9,731 ms
コンパイル使用メモリ 167,264 KB
実行使用メモリ 185,068 KB
最終ジャッジ日時 2024-04-23 13:09:46
合計ジャッジ時間 13,065 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
31,272 KB
testcase_01 AC 63 ms
31,384 KB
testcase_02 AC 1,771 ms
36,916 KB
testcase_03 AC 76 ms
36,864 KB
testcase_04 AC 64 ms
31,360 KB
testcase_05 AC 67 ms
31,344 KB
testcase_06 AC 63 ms
31,312 KB
testcase_07 AC 67 ms
31,216 KB
testcase_08 AC 63 ms
31,592 KB
testcase_09 AC 71 ms
31,664 KB
testcase_10 AC 65 ms
31,360 KB
testcase_11 AC 69 ms
31,648 KB
testcase_12 AC 76 ms
31,788 KB
testcase_13 AC 72 ms
31,920 KB
testcase_14 AC 74 ms
31,800 KB
testcase_15 AC 71 ms
32,000 KB
testcase_16 AC 71 ms
31,804 KB
testcase_17 AC 70 ms
31,796 KB
testcase_18 AC 71 ms
31,940 KB
testcase_19 AC 70 ms
31,800 KB
testcase_20 AC 69 ms
32,040 KB
testcase_21 AC 68 ms
31,928 KB
testcase_22 AC 68 ms
31,820 KB
testcase_23 AC 71 ms
185,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (86 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;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var s = Console.ReadLine().Trim();
        getAns(n, s);
    }
    static void getAns(int n, string s)
    {
        s = s.Replace("CPCTF", "a");
        var m = s.Length;
        var ans = (n - m) / 4;
        var start = 0;
        while (true)
        {
            var p = s.IndexOf("CPCTCPC", start);
            if (p == -1) break;
            ans++;
            var np = p + 7;
            if (np + 7 > m) break;
            start = np;
        }
        Console.WriteLine(ans);
    }
}
0