結果

問題 No.345 最小チワワ問題
ユーザー Crowea
提出日時 2019-01-25 15:58:42
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 853 bytes
コンパイル時間 863 ms
コンパイル使用メモリ 107,636 KB
実行使用メモリ 27,720 KB
最終ジャッジ日時 2024-09-16 04:48:32
合計ジャッジ時間 2,423 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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