結果

問題 No.627 ランダムウォークの軌跡
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-05-29 00:03:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 2,018 ms
コンパイル使用メモリ 71,500 KB
実行使用メモリ 56,332 KB
最終ジャッジ日時 2023-09-12 20:17:46
合計ジャッジ時間 7,369 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,632 KB
testcase_01 AC 122 ms
56,012 KB
testcase_02 AC 120 ms
55,728 KB
testcase_03 AC 120 ms
56,228 KB
testcase_04 AC 121 ms
55,832 KB
testcase_05 AC 121 ms
55,940 KB
testcase_06 AC 116 ms
56,036 KB
testcase_07 AC 118 ms
56,332 KB
testcase_08 AC 118 ms
55,908 KB
testcase_09 AC 119 ms
55,728 KB
testcase_10 AC 122 ms
56,000 KB
testcase_11 AC 123 ms
55,684 KB
testcase_12 AC 129 ms
56,212 KB
testcase_13 AC 124 ms
55,688 KB
testcase_14 AC 124 ms
55,656 KB
testcase_15 AC 123 ms
55,780 KB
testcase_16 AC 124 ms
55,704 KB
testcase_17 AC 125 ms
56,008 KB
testcase_18 AC 127 ms
55,468 KB
testcase_19 AC 128 ms
55,884 KB
testcase_20 AC 127 ms
55,884 KB
testcase_21 AC 126 ms
56,072 KB
testcase_22 AC 127 ms
55,828 KB
testcase_23 AC 127 ms
55,704 KB
testcase_24 AC 131 ms
56,020 KB
testcase_25 AC 128 ms
56,112 KB
testcase_26 AC 124 ms
55,708 KB
testcase_27 AC 131 ms
56,032 KB
testcase_28 AC 131 ms
56,060 KB
testcase_29 AC 129 ms
56,276 KB
testcase_30 AC 119 ms
55,916 KB
testcase_31 AC 121 ms
55,424 KB
testcase_32 AC 121 ms
55,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();

        String ans = "T";
        int[] x = new int[t];

        for(int i=0; i<t; i++) {
            x[i] = in.nextInt();
        }

        if(t == 1 && x[0] == 1)
            ans = "T";
        else if(t == 1 && x[0] == -1)
            ans = "T";
        else if(t == 1)
            ans = "F";

        if(x[0] == 0) ans = "F";
        for(int i=1; i<t; i++) {
            if(Math.abs(x[i-1] - x[i]) > 1 || x[i-1] == x[i]) {
                ans = "F";
                break;
            }
        }

        System.out.println(ans);
    }
}
0