結果

問題 No.653 E869120 and Lucky Numbers
ユーザー htensaihtensai
提出日時 2020-01-08 11:28:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,408 bytes
コンパイル時間 4,696 ms
コンパイル使用メモリ 76,968 KB
実行使用メモリ 50,296 KB
最終ジャッジ日時 2024-05-02 12:38:22
合計ジャッジ時間 5,885 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
37,088 KB
testcase_01 AC 53 ms
36,788 KB
testcase_02 AC 52 ms
36,700 KB
testcase_03 AC 51 ms
37,104 KB
testcase_04 AC 51 ms
37,024 KB
testcase_05 AC 51 ms
36,772 KB
testcase_06 WA -
testcase_07 AC 52 ms
36,628 KB
testcase_08 AC 52 ms
36,756 KB
testcase_09 AC 52 ms
36,796 KB
testcase_10 WA -
testcase_11 AC 51 ms
37,072 KB
testcase_12 WA -
testcase_13 AC 51 ms
37,072 KB
testcase_14 AC 54 ms
37,020 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 53 ms
37,072 KB
testcase_18 AC 52 ms
36,792 KB
testcase_19 AC 51 ms
36,528 KB
testcase_20 AC 53 ms
36,860 KB
testcase_21 AC 52 ms
37,008 KB
testcase_22 AC 51 ms
36,744 KB
testcase_23 AC 51 ms
36,496 KB
testcase_24 WA -
testcase_25 AC 51 ms
37,064 KB
testcase_26 AC 53 ms
36,968 KB
testcase_27 AC 52 ms
36,848 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 56 ms
37,112 KB
testcase_31 AC 52 ms
36,792 KB
testcase_32 AC 53 ms
36,968 KB
testcase_33 AC 53 ms
37,052 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