結果

問題 No.345 最小チワワ問題
ユーザー CroweaCrowea
提出日時 2019-01-25 15:58:42
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 853 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 65,032 KB
実行使用メモリ 24,752 KB
最終ジャッジ日時 2023-10-14 09:50:49
合計ジャッジ時間 3,834 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
22,572 KB
testcase_01 AC 52 ms
20,608 KB
testcase_02 AC 51 ms
22,608 KB
testcase_03 AC 51 ms
20,472 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 53 ms
22,504 KB
testcase_08 AC 54 ms
20,620 KB
testcase_09 AC 54 ms
20,524 KB
testcase_10 AC 52 ms
20,572 KB
testcase_11 AC 53 ms
20,652 KB
testcase_12 AC 52 ms
20,516 KB
testcase_13 AC 53 ms
18,408 KB
testcase_14 WA -
testcase_15 AC 51 ms
20,480 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 51 ms
22,692 KB
testcase_20 AC 51 ms
22,568 KB
testcase_21 AC 53 ms
20,664 KB
testcase_22 AC 51 ms
20,652 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 53 ms
20,616 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 52 ms
20,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public static class Program
{
    static void Main(string[] args)
    {
        var str = Console.ReadLine();

        for (int i=0; i < str.Length; i++)
        {
            if (str[i] == 'c')
            {
                for (int j= i + 1; j < str.Length; j++)
                {
                    if (str[j] == 'w')
                    {
                        for (int k = j + 1; k < str.Length; k++)
                        {
                            if (str[k] == 'w')
                            {
                                int len = (k - i) + 1;
                                Console.WriteLine(len);
                                return;
                            }
                        }
                    }
                }
            }
        }
        Console.WriteLine(-1);
    }
} // class Program
0