結果
問題 | No.653 E869120 and Lucky Numbers |
ユーザー | fal_rnd |
提出日時 | 2018-02-24 00:46:45 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,704 bytes |
コンパイル時間 | 2,353 ms |
コンパイル使用メモリ | 83,364 KB |
実行使用メモリ | 54,372 KB |
最終ジャッジ日時 | 2024-04-18 18:06:47 |
合計ジャッジ時間 | 7,383 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
53,824 KB |
testcase_01 | AC | 141 ms
54,032 KB |
testcase_02 | WA | - |
testcase_03 | AC | 112 ms
52,872 KB |
testcase_04 | AC | 123 ms
54,040 KB |
testcase_05 | WA | - |
testcase_06 | AC | 106 ms
52,920 KB |
testcase_07 | AC | 118 ms
53,812 KB |
testcase_08 | WA | - |
testcase_09 | AC | 123 ms
54,024 KB |
testcase_10 | AC | 105 ms
52,964 KB |
testcase_11 | AC | 127 ms
53,872 KB |
testcase_12 | AC | 120 ms
53,908 KB |
testcase_13 | AC | 118 ms
54,084 KB |
testcase_14 | WA | - |
testcase_15 | AC | 104 ms
53,196 KB |
testcase_16 | AC | 114 ms
54,124 KB |
testcase_17 | AC | 114 ms
54,108 KB |
testcase_18 | AC | 110 ms
53,948 KB |
testcase_19 | AC | 122 ms
54,112 KB |
testcase_20 | AC | 113 ms
54,308 KB |
testcase_21 | AC | 115 ms
53,836 KB |
testcase_22 | AC | 114 ms
53,840 KB |
testcase_23 | AC | 114 ms
54,372 KB |
testcase_24 | AC | 109 ms
53,004 KB |
testcase_25 | AC | 98 ms
52,716 KB |
testcase_26 | AC | 101 ms
52,800 KB |
testcase_27 | AC | 120 ms
53,948 KB |
testcase_28 | AC | 140 ms
54,148 KB |
testcase_29 | AC | 136 ms
54,212 KB |
testcase_30 | AC | 138 ms
54,036 KB |
testcase_31 | AC | 111 ms
54,192 KB |
testcase_32 | AC | 106 ms
53,912 KB |
testcase_33 | AC | 114 ms
52,892 KB |
ソースコード
import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.Scanner; import java.util.function.Supplier; import java.util.stream.IntStream; import java.util.stream.Stream; class Main{ static Scanner s=new Scanner(System.in); private void solve(){ char[]v=s.next().toCharArray(); for(int i:rrep(1,v.length-1)) { switch(v[i]-'0') { case 2: case 3: case 4: --v[i-1]; break; case 6: case 7: continue; default: System.out.println("No"); return; } } int c=v[0]-'0'; System.out.println(c==0||c==6||c==7?"Yes":"No"); } public static void main(String[]$){ new Main().solve(); } int gInt(){ return Integer.parseInt(s.next()); } long gLong(){ return Long.parseLong(s.next()); } double gDouble(){ return Double.parseDouble(s.next()); } SupplyingIterator<Integer> ints(int n){ return new SupplyingIterator<>(n,this::gInt); } SupplyingIterator<Long> longs(int n){ return new SupplyingIterator<>(n,this::gLong); } SupplyingIterator<Double> doubles(int n){ return new SupplyingIterator<>(n,this::gDouble); } SupplyingIterator<String> strs(int n){ return new SupplyingIterator<>(n,s::next); } Range rep(int i){ return Range.rep(i); } Range rep(int f,int t,int d){ return Range.rep(f,t,d); } Range rep(int f,int t){ return rep(f,t,1); } Range rrep(int f,int t){ return rep(t,f,-1); } IntStream REP(int v){ return IntStream.range(0,v); } IntStream REP(int l,int r){ return IntStream.rangeClosed(l,r); } IntStream INTS(int n){ return IntStream.generate(this::gInt).limit(n); } Stream<String> STRS(int n){ return Stream.generate(s::next).limit(n); } } class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{ int t; Supplier<T> supplier; SupplyingIterator(int t,Supplier<T> supplier){ this.t=t; this.supplier=supplier; } @Override public Iterator<T> iterator(){ return this; } @Override public boolean hasNext(){ return t>0; } @Override public T next(){ --t; return supplier.get(); } } class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{ int to,cur,d; Range(int from,int to,int d){ this.cur=from-d; this.to=to; this.d=d; } Range(int n){ this(0,n-1,1); } @Override public Iterator<Integer> iterator(){ return this; } @Override public boolean hasNext(){ return cur+d==to||(cur!=to&&(cur<to==cur+d<to)); } @Override public int nextInt(){ return cur+=d; } static Range rep(int i){ return new Range(i); } static Range rep(int f,int t,int d){ return new Range(f,t,d); } static Range rep(int f,int t){ return rep(f,t,1); } static Range rrep(int f,int t){ return rep(f,t,-1); } }