結果

問題 No.1005 BOT対策
ユーザー bluemeganebluemegane
提出日時 2020-03-07 07:25:24
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 766 bytes
コンパイル時間 4,828 ms
コンパイル使用メモリ 107,308 KB
実行使用メモリ 25,680 KB
最終ジャッジ日時 2024-04-22 12:09:02
合計ジャッジ時間 2,854 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
18,176 KB
testcase_01 AC 24 ms
18,048 KB
testcase_02 AC 24 ms
18,432 KB
testcase_03 AC 26 ms
18,048 KB
testcase_04 AC 21 ms
17,664 KB
testcase_05 AC 24 ms
18,304 KB
testcase_06 AC 21 ms
17,408 KB
testcase_07 AC 21 ms
17,408 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 22 ms
17,536 KB
testcase_11 AC 25 ms
18,432 KB
testcase_12 WA -
testcase_13 AC 25 ms
18,432 KB
testcase_14 AC 25 ms
18,304 KB
testcase_15 AC 24 ms
17,920 KB
testcase_16 AC 25 ms
18,304 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 21 ms
17,536 KB
testcase_20 AC 21 ms
17,408 KB
testcase_21 AC 20 ms
17,792 KB
testcase_22 AC 20 ms
17,664 KB
testcase_23 AC 24 ms
18,304 KB
testcase_24 AC 24 ms
18,432 KB
testcase_25 AC 25 ms
18,432 KB
testcase_26 AC 25 ms
18,176 KB
testcase_27 AC 20 ms
17,280 KB
testcase_28 WA -
testcase_29 AC 25 ms
18,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        var t = Console.ReadLine().Trim();
        getAns(s, t);

    }
    static void getAns (string s, string t)
    {
        if (t.Length == 1) { Console.WriteLine(-1); return; }
        var count = 0;
        var sL = s.Length;
        var tL = t.Length;
        var t9 = t.Substring(0, tL - 1);
        var t1 = t[tL - 1];
        var p = 0;
        while (p <sL - tL)
        {
            var w = s.IndexOf(t9, p);
            if (w == -1) break;
            else
            {
                if (s[w + tL-1] == t1) { count++; p = w + tL - 1; }
                else p = w + tL - 1;
            }
        }
        Console.WriteLine(count);
    }
}
0