結果

問題 No.627 ランダムウォークの軌跡
ユーザー Crowea
提出日時 2019-01-22 19:18:52
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 715 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 113,332 KB
実行使用メモリ 25,984 KB
最終ジャッジ日時 2024-09-16 04:15:24
合計ジャッジ時間 3,134 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Program
{
    static void Main(string[] args)
    {
        var T = int.Parse(Console.ReadLine());
        var list = new List<int> { 0 };
        bool isRandomWalk = false;

        int x;
        for (int i=0; i<T; i++)
        {
            x = int.Parse(Console.ReadLine());
            if (x == list[0]) break;
            list.Add(x);
        }

        int pos;
        for (int j=0; j<list.Count -1; j++)
        {
            pos = Math.Abs(list[j + 1] - list[j]);
            isRandomWalk = (1 <= pos && pos < 2) ? true : false;
            if (!isRandomWalk) break;
        }

        Console.WriteLine((isRandomWalk == true) ? "T" : "F");
    }
}

0