結果

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

ソースコード

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 || temp==0) {possible = false; break;}
			}
			System.out.println(possible==true?"T":"F");
		}
	}
}
0