結果

問題 No.653 E869120 and Lucky Numbers
ユーザー htensaihtensai
提出日時 2020-01-08 11:31:43
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,408 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 74,016 KB
実行使用メモリ 51,132 KB
最終ジャッジ日時 2023-08-15 00:26:51
合計ジャッジ時間 4,689 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,316 KB
testcase_01 AC 42 ms
49,140 KB
testcase_02 AC 42 ms
49,132 KB
testcase_03 AC 42 ms
49,316 KB
testcase_04 AC 42 ms
49,156 KB
testcase_05 AC 42 ms
49,160 KB
testcase_06 AC 43 ms
49,032 KB
testcase_07 AC 43 ms
49,536 KB
testcase_08 AC 43 ms
49,136 KB
testcase_09 AC 42 ms
49,160 KB
testcase_10 AC 43 ms
49,240 KB
testcase_11 AC 43 ms
49,180 KB
testcase_12 WA -
testcase_13 AC 42 ms
49,156 KB
testcase_14 AC 43 ms
49,028 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 42 ms
49,244 KB
testcase_18 AC 43 ms
49,480 KB
testcase_19 AC 43 ms
49,352 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 43 ms
51,132 KB
testcase_23 AC 42 ms
49,288 KB
testcase_24 WA -
testcase_25 AC 43 ms
49,368 KB
testcase_26 AC 42 ms
49,288 KB
testcase_27 AC 42 ms
49,352 KB
testcase_28 AC 45 ms
47,520 KB
testcase_29 AC 46 ms
49,220 KB
testcase_30 WA -
testcase_31 AC 43 ms
49,220 KB
testcase_32 AC 42 ms
49,320 KB
testcase_33 AC 42 ms
49,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] arr = br.readLine().toCharArray();
        int length = arr.length;
        int last = arr[length - 1] - '0';
        if (last < 2 || last > 4) {
            System.out.println("No");
            return;
        }
        int num = 0;
        for (int i = last - 2; i >= 0; i--) {
            int x = arr[i] - '0';
            if (num == 0) {
                if (i == 0) {
                    if (x == 1 || x == 7 || x == 8) {
                        System.out.println("Yes");
                    } else {
                        System.out.println("No");
                    }
                    return;
                }
                if (x - 1 >= 2 && x - 1 <= 4) {
                    continue;
                }
                if (x - 1 == 6) {
                    num = 6;
                } else if (x - 1 == 7) {
                    num = 7;
                } else {
                    System.out.println("No");
                    return;
                }
            } else {
                if (x != 6 && x != 7) {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}
0