結果

問題 No.345 最小チワワ問題
ユーザー funakoshifunakoshi
提出日時 2019-06-27 15:39:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,534 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 102,472 KB
実行使用メモリ 22,676 KB
最終ジャッジ日時 2023-09-10 09:37:13
合計ジャッジ時間 5,246 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,528 KB
testcase_01 AC 51 ms
20,572 KB
testcase_02 AC 52 ms
22,548 KB
testcase_03 AC 52 ms
20,628 KB
testcase_04 AC 52 ms
20,512 KB
testcase_05 AC 52 ms
20,576 KB
testcase_06 AC 52 ms
22,628 KB
testcase_07 AC 51 ms
22,584 KB
testcase_08 AC 49 ms
22,584 KB
testcase_09 AC 49 ms
20,520 KB
testcase_10 AC 53 ms
20,692 KB
testcase_11 AC 50 ms
22,476 KB
testcase_12 AC 50 ms
20,456 KB
testcase_13 AC 49 ms
20,580 KB
testcase_14 AC 53 ms
22,676 KB
testcase_15 AC 52 ms
18,456 KB
testcase_16 AC 52 ms
20,520 KB
testcase_17 AC 52 ms
20,700 KB
testcase_18 AC 51 ms
20,536 KB
testcase_19 AC 51 ms
20,512 KB
testcase_20 AC 51 ms
20,588 KB
testcase_21 AC 49 ms
20,468 KB
testcase_22 AC 51 ms
20,536 KB
testcase_23 AC 52 ms
20,588 KB
testcase_24 AC 52 ms
20,504 KB
testcase_25 AC 51 ms
20,580 KB
testcase_26 AC 51 ms
20,528 KB
testcase_27 AC 52 ms
20,524 KB
testcase_28 AC 48 ms
20,496 KB
testcase_29 AC 53 ms
20,596 KB
testcase_30 AC 51 ms
18,420 KB
testcase_31 AC 50 ms
20,452 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int len = 0;
            int minlen = 100;
            bool fw = true;
            for (int i = 0; i < input.Length - 1; i++)
            {
                string c = input.Substring(i, 1);
                if (c == "c")
                {
                    len++;
                    fw = true;
                }
                else
                {
                    continue;
                }
                for (int j = i + 1; j < input.Length; j++)
                {
                    string w = input.Substring(j, 1);
                    if (w == "w" && fw == true)
                    {
                        fw = false;

                    }
                    else if (w == "w" && fw == false)
                    {
                        len++;
                        if (minlen > len)
                        {
                            minlen = len;
                        }
                        len = 0;
                        break;
                    }
                    len++;
                }


            }
            if (minlen != 100)
            {
                Console.WriteLine(minlen);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }

    }
}
0