結果

問題 No.653 E869120 and Lucky Numbers
ユーザー eessmmnn52eessmmnn52
提出日時 2018-05-31 09:52:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,768 bytes
コンパイル時間 3,663 ms
コンパイル使用メモリ 76,228 KB
実行使用メモリ 58,796 KB
最終ジャッジ日時 2023-09-12 20:56:41
合計ジャッジ時間 10,084 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 132 ms
56,392 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 148 ms
57,560 KB
testcase_07 AC 128 ms
54,416 KB
testcase_08 WA -
testcase_09 AC 120 ms
55,796 KB
testcase_10 AC 117 ms
55,872 KB
testcase_11 AC 121 ms
55,868 KB
testcase_12 AC 119 ms
55,712 KB
testcase_13 AC 122 ms
55,960 KB
testcase_14 AC 118 ms
56,460 KB
testcase_15 AC 121 ms
56,068 KB
testcase_16 AC 121 ms
55,708 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 121 ms
56,064 KB
testcase_21 AC 121 ms
55,896 KB
testcase_22 AC 122 ms
55,980 KB
testcase_23 AC 122 ms
56,028 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 219 ms
58,472 KB
testcase_29 AC 214 ms
58,184 KB
testcase_30 WA -
testcase_31 AC 119 ms
55,572 KB
testcase_32 AC 122 ms
55,748 KB
testcase_33 AC 120 ms
55,924 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("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("x:" + x + ": y:" + y);
        			System.out.println("No");
        			return;
        		}
        	}

        }
// 検証用
//        System.out.println("x:" + x + ": y:" + y);
		System.out.println("Yes");
    }
}
0