結果
問題 | No.653 E869120 and Lucky Numbers |
ユーザー | tetsu |
提出日時 | 2018-02-23 23:46:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 2,692 bytes |
コンパイル時間 | 3,617 ms |
コンパイル使用メモリ | 79,828 KB |
実行使用メモリ | 51,036 KB |
最終ジャッジ日時 | 2024-09-13 18:16:48 |
合計ジャッジ時間 | 6,592 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
50,192 KB |
testcase_01 | AC | 55 ms
50,284 KB |
testcase_02 | AC | 56 ms
49,968 KB |
testcase_03 | AC | 57 ms
50,316 KB |
testcase_04 | AC | 55 ms
49,980 KB |
testcase_05 | AC | 55 ms
50,352 KB |
testcase_06 | AC | 56 ms
50,132 KB |
testcase_07 | AC | 54 ms
50,076 KB |
testcase_08 | AC | 58 ms
50,368 KB |
testcase_09 | AC | 54 ms
49,964 KB |
testcase_10 | AC | 54 ms
50,272 KB |
testcase_11 | AC | 54 ms
50,048 KB |
testcase_12 | AC | 54 ms
50,312 KB |
testcase_13 | AC | 53 ms
50,280 KB |
testcase_14 | AC | 53 ms
49,984 KB |
testcase_15 | AC | 54 ms
50,532 KB |
testcase_16 | AC | 54 ms
50,440 KB |
testcase_17 | AC | 54 ms
50,400 KB |
testcase_18 | AC | 54 ms
50,440 KB |
testcase_19 | AC | 53 ms
50,104 KB |
testcase_20 | AC | 53 ms
50,196 KB |
testcase_21 | AC | 53 ms
50,084 KB |
testcase_22 | AC | 54 ms
49,940 KB |
testcase_23 | AC | 54 ms
50,000 KB |
testcase_24 | AC | 54 ms
50,516 KB |
testcase_25 | AC | 55 ms
50,096 KB |
testcase_26 | AC | 54 ms
50,324 KB |
testcase_27 | AC | 54 ms
50,008 KB |
testcase_28 | AC | 80 ms
50,916 KB |
testcase_29 | AC | 81 ms
50,984 KB |
testcase_30 | AC | 72 ms
51,036 KB |
testcase_31 | AC | 54 ms
50,088 KB |
testcase_32 | AC | 54 ms
50,324 KB |
testcase_33 | AC | 54 ms
50,308 KB |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.PrintWriter;import java.util.*;public class C {static Random rg = new Random();public static void main(String[] args) throws IOException {MyScanner sc = new MyScanner(System.in);// String p = random();// System.out.println(p);String p = sc.next();if(p.length()==1) {System.out.println("No");return;}int[] ds = new int[20000];for(int i=0; i<p.length(); i++) {ds[i] = Character.getNumericValue(p.charAt(p.length()-1-i));}for(int i=0; i<p.length(); i++) {if(i==p.length()-1) {if(ds[i]==0 || ds[i]==7 || ds[i]==6) {System.out.println("Yes");return;} else {System.out.println("No");return;}}if(i==0) {if(ds[i]==2||ds[i]==3||ds[i]==4) {if(ds[i+1]>=1) {ds[i+1]--;continue;} else {System.out.println("No");return;}} else {System.out.println("No");return;}}if(ds[i]==2||ds[i]==3||ds[i]==4) {if(ds[i+1]>=1) {ds[i+1]--;} else {System.out.println("No");return;}} else if(ds[i]==6||ds[i]==7) {for(int j=i; j<p.length(); j++) {if(ds[j]!=6&&ds[j]!=7) {System.out.println("No");return;}}System.out.println("Yes");return;} else {System.out.println("No");return;}}}static String random() {int t1 = rg.nextInt(10);long a1 = 7;for(int i=0; i<t1; i++) {int test = rg.nextInt();a1 = a1*10;if(test%2==0) {a1 += 6;} else {a1 += 7;}}int t2 = rg.nextInt(10);long a2 = 6;for(int i=0; i<t2; i++) {int test = rg.nextInt();a2= a2*10;if(test%2==0) {a2 += 6;} else {a2 += 7;}}System.out.println("a1=" + a1 + ",a2="+a2);return Long.toString(a1+a2);}static class MyScanner{BufferedReader br;StringTokenizer st;public MyScanner(InputStream s){br=new BufferedReader(new InputStreamReader(s));}public String nextLine() throws IOException{return br.readLine();}public String next() throws IOException{while(st==null || !st.hasMoreTokens())st=new StringTokenizer(br.readLine());return st.nextToken();}public int nextInt() throws IOException{return Integer.parseInt(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public boolean ready() throws IOException{return br.ready();}public long nextLong() throws IOException{return Long.parseLong(next());}}}