結果

問題 No.345 最小チワワ問題
ユーザー fujitafujita
提出日時 2023-05-10 16:01:09
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,200 bytes
コンパイル時間 11,818 ms
コンパイル使用メモリ 146,204 KB
実行使用メモリ 161,432 KB
最終ジャッジ日時 2023-08-17 20:56:39
合計ジャッジ時間 12,401 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
26,336 KB
testcase_01 AC 47 ms
28,276 KB
testcase_02 AC 46 ms
28,440 KB
testcase_03 AC 47 ms
28,356 KB
testcase_04 AC 47 ms
26,448 KB
testcase_05 WA -
testcase_06 AC 46 ms
26,220 KB
testcase_07 AC 45 ms
28,140 KB
testcase_08 AC 45 ms
25,964 KB
testcase_09 AC 45 ms
25,940 KB
testcase_10 AC 47 ms
26,244 KB
testcase_11 AC 45 ms
25,904 KB
testcase_12 AC 44 ms
26,068 KB
testcase_13 AC 45 ms
28,220 KB
testcase_14 AC 47 ms
28,128 KB
testcase_15 AC 47 ms
28,392 KB
testcase_16 AC 47 ms
26,296 KB
testcase_17 AC 47 ms
26,436 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 46 ms
26,300 KB
testcase_21 AC 45 ms
26,220 KB
testcase_22 AC 46 ms
26,376 KB
testcase_23 AC 47 ms
28,084 KB
testcase_24 AC 46 ms
26,212 KB
testcase_25 AC 47 ms
26,440 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 45 ms
26,168 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 46 ms
161,432 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 162 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;
namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {

            var str = Console.ReadLine();
            string[] strings = new string[str.Length];
            int C = 0 , W = 0 ,  Ccnt = 0 , Wcnt = 0 , anscount = 0;


            for (int i = 0; i < str.Length; i++)
            {
                if(str.Substring(i,1) == "c" && Wcnt == 0)
                {        
                    C = 1;
                    Ccnt = i;
                }
                else if (str.Substring(i, 1) == "w" && C == 1)
                {
                    W++;
                    Wcnt = i;
                }
                
                if(C == 1 && W == 2)
                {
                    int sum = Wcnt - Ccnt + 1;
                    anscount = sum;
                    C = 0;
                    Ccnt = 0;
                    W = 0;
                    Wcnt = 0;
                }
                
            }

            if(anscount > 0)
            {
                Console.WriteLine(anscount);
            }
            else if (anscount == 0)
            {
                Console.WriteLine("-1");
            }
        }
    }
}
0