結果

問題 No.653 E869120 and Lucky Numbers
ユーザー eessmmnn52eessmmnn52
提出日時 2018-05-31 09:29:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,645 bytes
コンパイル時間 2,539 ms
コンパイル使用メモリ 76,084 KB
実行使用メモリ 58,500 KB
最終ジャッジ日時 2023-09-12 20:56:28
合計ジャッジ時間 8,843 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,696 KB
testcase_01 AC 136 ms
56,476 KB
testcase_02 AC 149 ms
56,220 KB
testcase_03 AC 165 ms
56,180 KB
testcase_04 AC 161 ms
58,420 KB
testcase_05 AC 161 ms
58,500 KB
testcase_06 WA -
testcase_07 AC 136 ms
55,480 KB
testcase_08 AC 178 ms
58,484 KB
testcase_09 AC 126 ms
55,972 KB
testcase_10 AC 121 ms
55,992 KB
testcase_11 AC 125 ms
55,596 KB
testcase_12 AC 124 ms
56,012 KB
testcase_13 AC 127 ms
55,924 KB
testcase_14 AC 117 ms
55,836 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 126 ms
56,000 KB
testcase_18 AC 124 ms
56,040 KB
testcase_19 AC 124 ms
56,068 KB
testcase_20 AC 124 ms
55,928 KB
testcase_21 AC 125 ms
56,064 KB
testcase_22 AC 125 ms
55,876 KB
testcase_23 AC 126 ms
55,964 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 208 ms
58,288 KB
testcase_31 AC 125 ms
55,552 KB
testcase_32 AC 126 ms
56,180 KB
testcase_33 AC 126 ms
56,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);

        String p = sc.next();
        StringBuffer buf = new StringBuffer(p);
        String revStr = buf.reverse().toString(); // pを反転

        String x = "";
        String y = "";
        for(int i = 0; i < revStr.length(); i++){
        	if(i == 0){
        		if(revStr.substring(i, i + 1).contains("2")){
        			x += "6";
        			y += "6";
        		}else if(revStr.substring(i, i + 1).contains("3")){
        			x += "7";
        			y += "6";
        		}else if(revStr.substring(i, i + 1).contains("4")){
        			x += "7";
        			y += "7";
        		}else{
        			System.out.println("No");
        			return;
        		}
        	}else if(i > 0){
        		if(revStr.substring(i, i + 1).contains("8")){
        			x += "7";
        		}else if(revStr.substring(i, i + 1).contains("7")){
        			x += "6";
        		}else if(revStr.substring(i, i + 1).contains("5")){
        			x += "7";
        			y += "7";
        		}else if(revStr.substring(i, i + 1).contains("4")){
        			x += "7";
        			y += "6";
        		}else if(revStr.substring(i, i + 1).contains("3")){
        			x += "6";
        			y += "6";
        		}else if(revStr.substring(i, i + 1).contains("1")){
        		}else{
        			System.out.println("No");
        			return;
        		}
        	}

        }
// 検証用
//		System.out.println(x);
//		System.out.println(y);

		System.out.println("Yes");
    }
}
0