結果

問題 No.653 E869120 and Lucky Numbers
ユーザー Tsukasa_Type
提出日時 2018-02-23 23:08:51
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 2,488 ms
コンパイル使用メモリ 78,980 KB
実行使用メモリ 53,828 KB
最終ジャッジ日時 2024-10-10 02:16:45
合計ジャッジ時間 8,523 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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