結果

問題 No.627 ランダムウォークの軌跡
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 02:19:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 1,947 ms
コンパイル使用メモリ 75,052 KB
実行使用メモリ 54,712 KB
最終ジャッジ日時 2024-04-09 20:54:19
合計ジャッジ時間 6,639 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
52,892 KB
testcase_01 AC 105 ms
52,892 KB
testcase_02 AC 107 ms
53,952 KB
testcase_03 AC 112 ms
54,028 KB
testcase_04 AC 112 ms
53,972 KB
testcase_05 AC 111 ms
54,160 KB
testcase_06 AC 101 ms
53,136 KB
testcase_07 AC 103 ms
53,024 KB
testcase_08 AC 114 ms
54,108 KB
testcase_09 AC 111 ms
54,124 KB
testcase_10 AC 102 ms
52,900 KB
testcase_11 AC 113 ms
54,008 KB
testcase_12 AC 112 ms
54,032 KB
testcase_13 AC 104 ms
52,756 KB
testcase_14 AC 116 ms
54,100 KB
testcase_15 AC 116 ms
54,080 KB
testcase_16 AC 115 ms
53,736 KB
testcase_17 AC 107 ms
53,372 KB
testcase_18 AC 109 ms
54,296 KB
testcase_19 AC 100 ms
54,712 KB
testcase_20 AC 114 ms
54,028 KB
testcase_21 AC 124 ms
54,124 KB
testcase_22 AC 114 ms
53,992 KB
testcase_23 AC 116 ms
54,052 KB
testcase_24 AC 119 ms
54,248 KB
testcase_25 AC 110 ms
53,768 KB
testcase_26 AC 120 ms
54,220 KB
testcase_27 AC 121 ms
54,128 KB
testcase_28 AC 123 ms
54,308 KB
testcase_29 AC 120 ms
54,344 KB
testcase_30 AC 101 ms
52,732 KB
testcase_31 AC 112 ms
54,224 KB
testcase_32 AC 111 ms
54,308 KB
権限があれば一括ダウンロードができます

ソースコード

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