結果

問題 No.627 ランダムウォークの軌跡
ユーザー Tsukasa_Type
提出日時 2018-02-09 02:17:36
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 74,932 KB
実行使用メモリ 54,736 KB
最終ジャッジ日時 2024-10-01 21:17:30
合計ジャッジ時間 7,867 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;}
			}
			System.out.println(possible==true?"T":"F");
		}
	}
}
0