結果

問題 No.653 E869120 and Lucky Numbers
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-23 23:04:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 682 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 75,664 KB
実行使用メモリ 54,372 KB
最終ジャッジ日時 2024-04-18 08:51:09
合計ジャッジ時間 6,850 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
52,948 KB
testcase_01 AC 107 ms
53,140 KB
testcase_02 AC 109 ms
53,140 KB
testcase_03 AC 121 ms
53,192 KB
testcase_04 AC 117 ms
54,128 KB
testcase_05 AC 111 ms
52,972 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 125 ms
54,164 KB
testcase_09 AC 117 ms
54,164 KB
testcase_10 AC 107 ms
54,372 KB
testcase_11 AC 97 ms
53,108 KB
testcase_12 AC 105 ms
53,588 KB
testcase_13 AC 107 ms
53,844 KB
testcase_14 AC 109 ms
53,032 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 111 ms
54,124 KB
testcase_18 AC 108 ms
53,944 KB
testcase_19 AC 98 ms
52,860 KB
testcase_20 AC 112 ms
54,032 KB
testcase_21 AC 106 ms
54,288 KB
testcase_22 AC 113 ms
54,012 KB
testcase_23 AC 109 ms
53,960 KB
testcase_24 AC 107 ms
54,028 KB
testcase_25 AC 117 ms
53,344 KB
testcase_26 AC 118 ms
53,960 KB
testcase_27 AC 118 ms
54,028 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 136 ms
53,884 KB
testcase_31 AC 115 ms
54,176 KB
testcase_32 AC 108 ms
54,156 KB
testcase_33 AC 111 ms
54,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		System.out.println(judge(s)==true?"Yes":"No");
	}
	
	static boolean judge (String s) {
		if (s.length()==1) {
			if (s.matches("[67]")==false) {return false;}
		}
		else {
			for (int i=0; i<s.length(); i++) {
				if (i==0) {
					if (s.charAt(0)!='1') {return false;}
				}
				else if (i==s.length()-1) {
					char c = s.charAt(s.length()-1);
					if (c!='2' && c!='3' && c!='4') {return false;}
				}
				else {
					char c = s.charAt(i);
					if (c!='3' && c!='4' && c!='5') {return false;}
				}
			}
		}
		return true;
	}
}
0