結果

問題 No.345 最小チワワ問題
ユーザー funakoshifunakoshi
提出日時 2019-06-27 14:49:26
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 101,800 KB
実行使用メモリ 25,332 KB
最終ジャッジ日時 2023-09-10 08:16:43
合計ジャッジ時間 5,993 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 69 ms
21,308 KB
testcase_05 WA -
testcase_06 AC 68 ms
21,040 KB
testcase_07 AC 65 ms
21,264 KB
testcase_08 WA -
testcase_09 AC 65 ms
21,080 KB
testcase_10 WA -
testcase_11 AC 67 ms
23,204 KB
testcase_12 AC 68 ms
21,256 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 66 ms
21,240 KB
testcase_22 WA -
testcase_23 AC 69 ms
23,108 KB
testcase_24 AC 69 ms
21,188 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 66 ms
19,192 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 66 ms
21,108 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 cnum = input.IndexOf("c", 0);
            int wcnt = 0;
            int length = -1;
            for(int i=cnum+1;i<input.Length;i++)
            {
                string temp = input.Substring(i, 1);
                if(temp=="w")
                {
                    wcnt++;
                    if(wcnt==2)
                    {
                        length = i;
                        break;
                    }
                }
            }
            if (length != -1)
            {
                Console.WriteLine(length - cnum);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }

    }
}
0