結果
問題 | No.627 ランダムウォークの軌跡 |
ユーザー |
|
提出日時 | 2019-01-22 19:24:46 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 1,205 ms |
コンパイル使用メモリ | 109,156 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-09-16 04:15:45 |
合計ジャッジ時間 | 3,360 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; class Program { static void Main(string[] args) { var T = int.Parse(Console.ReadLine()); var list = new List<int>(); bool isRandomWalk = false; int x; for (int i=0; i < T; i++) { x = int.Parse(Console.ReadLine()); list.Add(x); } int pos; for (int j=0; j<list.Count; j++) { pos = (j == 0) ? Math.Abs(list[j]) : Math.Abs(list[j] - list[j-1]); isRandomWalk = (1 <= pos && pos < 2) ? true : false; if (!isRandomWalk) break; } Console.WriteLine((isRandomWalk == true) ? "T" : "F"); } }