結果

問題 No.1005 BOT対策
ユーザー phsplsphspls
提出日時 2020-03-26 00:35:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 1,989 ms
コンパイル使用メモリ 98,940 KB
実行使用メモリ 23,480 KB
最終ジャッジ日時 2023-08-30 11:58:03
合計ジャッジ時間 5,388 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
21,320 KB
testcase_01 AC 73 ms
21,380 KB
testcase_02 AC 73 ms
21,376 KB
testcase_03 AC 74 ms
21,456 KB
testcase_04 AC 50 ms
22,552 KB
testcase_05 AC 74 ms
21,528 KB
testcase_06 AC 50 ms
22,664 KB
testcase_07 AC 50 ms
20,516 KB
testcase_08 AC 73 ms
21,336 KB
testcase_09 AC 73 ms
21,460 KB
testcase_10 AC 51 ms
20,620 KB
testcase_11 AC 73 ms
21,412 KB
testcase_12 AC 73 ms
23,372 KB
testcase_13 AC 73 ms
21,544 KB
testcase_14 AC 74 ms
21,388 KB
testcase_15 AC 73 ms
21,276 KB
testcase_16 AC 73 ms
23,480 KB
testcase_17 AC 73 ms
23,376 KB
testcase_18 AC 75 ms
23,456 KB
testcase_19 AC 49 ms
20,524 KB
testcase_20 AC 50 ms
22,564 KB
testcase_21 AC 52 ms
20,612 KB
testcase_22 AC 52 ms
22,664 KB
testcase_23 AC 74 ms
23,384 KB
testcase_24 AC 73 ms
21,496 KB
testcase_25 AC 74 ms
23,448 KB
testcase_26 AC 74 ms
21,384 KB
testcase_27 AC 49 ms
18,532 KB
testcase_28 AC 74 ms
21,332 KB
testcase_29 AC 74 ms
21,392 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.Linq;

public class P1005 {
    public static void Main() {
        var s = Console.ReadLine();
        var t = Console.ReadLine();
        if(t.Length == 1 && s.Contains(t)) {
            Console.WriteLine("-1");
        } else {
            int count = 0;
            for(int i=0; i<s.Length + 1 - t.Length; i++) {
                if(s.Substring(i).StartsWith(t)) {
                    count += 1;
                    i += t.Length - 2;
                }
            }
            Console.WriteLine(count);
        }
    }
}
0