結果

問題 No.430 文字列検索
ユーザー wowilsonwowilson
提出日時 2016-10-07 16:16:13
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 947 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 109,220 KB
実行使用メモリ 23,168 KB
最終ジャッジ日時 2024-05-01 14:53:26
合計ジャッジ時間 5,989 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
23,168 KB
testcase_01 AC 1,447 ms
21,760 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static string S;
        static int sum;
        static void Main(string[] args)
        {
            S = Console.ReadLine();
            sum = 0;

            var m = int.Parse(Console.ReadLine());
            for (int i = 0; i < m; i++)
            {
                var str = Console.ReadLine();

                CheckStr(str);
            }
            Console.WriteLine(sum);
        }

        private static void CheckStr(string str)
        {
            for (int i = 0; i < S.Length; i++)
            {
                if(str[0] == S[i])
                {
                    if (i + str.Length > S.Length)
                        break;
                    var sub = S.Substring(i, str.Length);
                    if(str == sub)
                    {
                        sum++;
                    }

                }
            }
        }
    }


}
0