結果

問題 No.486 3 Straight Win(3連勝)
ユーザー funakoshifunakoshi
提出日時 2019-06-28 11:45:37
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,746 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 104,160 KB
実行使用メモリ 24,644 KB
最終ジャッジ日時 2023-09-14 21:19:24
合計ジャッジ時間 4,456 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 49 ms
22,456 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 49 ms
20,532 KB
testcase_11 AC 49 ms
20,520 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 49 ms
22,564 KB
testcase_15 WA -
testcase_16 AC 48 ms
22,504 KB
testcase_17 AC 49 ms
20,504 KB
testcase_18 AC 48 ms
20,460 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 48 ms
20,464 KB
testcase_22 AC 48 ms
20,468 KB
testcase_23 WA -
testcase_24 AC 49 ms
20,404 KB
testcase_25 AC 48 ms
20,624 KB
testcase_26 AC 49 ms
20,472 KB
testcase_27 AC 49 ms
20,548 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 west = 1;
            int east = 1;
            string before = input.Substring(0,1);
            bool win = false;
            for(int i=1;i<input.Length;i++)
            {
                string temp = input.Substring(i, 1);
                if(temp=="O")
                {
                    if (before == temp)
                    {
                        west++;
                        before = temp;
                    }
                    else
                    {
                        west = 1;
                        before = temp;
                    }
                    if (east == 3)
                    {
                        Console.WriteLine("West");
                        win = true;
                        break;
                    }
                }
                else
                {
                    if (before == temp)
                    {
                        east++;
                        before = temp;
                    }
                    else
                    {
                        east = 1;
                        before = temp;
                    }

                    if (east==3)
                    {
                        Console.WriteLine("East");
                        win = true;
                        break;
                    }
                }
            }
            if(win==false)
            {
                Console.WriteLine("NA");
            }
        }

    }
}
0