結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 118 ms
55,832 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 125 ms
56,084 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 124 ms
55,376 KB
testcase_14 WA -
testcase_15 AC 125 ms
56,276 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 128 ms
56,048 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 136 ms
55,360 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 134 ms
56,076 KB
testcase_28 WA -
testcase_29 AC 136 ms
55,784 KB
testcase_30 AC 129 ms
55,972 KB
testcase_31 AC 126 ms
55,992 KB
testcase_32 AC 117 ms
55,740 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
            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