結果

問題 No.627 ランダムウォークの軌跡
ユーザー Tsukasa_Type
提出日時 2018-02-09 02:18:50
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 2,261 ms
コンパイル使用メモリ 75,436 KB
実行使用メモリ 54,512 KB
最終ジャッジ日時 2024-10-01 21:17:42
合計ジャッジ時間 7,388 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] ints = new int[n];
		for (int i=0; i<n; i++) {
			ints[i] = sc.nextInt();
		}
		if (ints[0]==0 || ints[0] > 1 || ints[0] < -1) {System.out.println("F");}
		else {
			boolean possible = true;
			for (int i=0; i<n-1; i++) {
				int temp = Math.abs(ints[i+1]-ints[i]);
				if (temp > 1) {possible = false; break;}
			}
			System.out.println(possible==true?"T":"F");
		}
	}
}
0