結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
53,880 KB
testcase_01 AC 134 ms
54,144 KB
testcase_02 AC 142 ms
53,964 KB
testcase_03 AC 144 ms
53,896 KB
testcase_04 AC 133 ms
54,060 KB
testcase_05 AC 133 ms
54,120 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 133 ms
54,272 KB
testcase_09 AC 109 ms
52,992 KB
testcase_10 AC 114 ms
54,140 KB
testcase_11 AC 123 ms
54,180 KB
testcase_12 AC 110 ms
53,884 KB
testcase_13 AC 122 ms
53,972 KB
testcase_14 AC 123 ms
54,164 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 124 ms
54,208 KB
testcase_18 AC 123 ms
54,076 KB
testcase_19 AC 127 ms
54,028 KB
testcase_20 AC 122 ms
54,052 KB
testcase_21 AC 122 ms
54,108 KB
testcase_22 AC 124 ms
54,108 KB
testcase_23 AC 122 ms
54,268 KB
testcase_24 AC 102 ms
52,992 KB
testcase_25 AC 125 ms
54,052 KB
testcase_26 AC 110 ms
53,012 KB
testcase_27 AC 123 ms
53,960 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 139 ms
54,136 KB
testcase_31 AC 109 ms
52,984 KB
testcase_32 AC 122 ms
54,132 KB
testcase_33 AC 126 ms
54,240 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) {
			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