結果

問題 No.653 E869120 and Lucky Numbers
ユーザー ts_ts_
提出日時 2018-04-06 22:54:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 837 bytes
コンパイル時間 1,142 ms
コンパイル使用メモリ 144,556 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 18:05:11
合計ジャッジ時間 3,051 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int cur=0;
    int n=s.size();
    for(int i=n-1;i>=0;--i){
        if(cur==0){
            if(s[i]=='7'||s[i]=='6');
            else if(s[i]=='2'||s[i]=='3'||s[i]=='4') cur=1;
            else{
                cout<<"No"<<endl;
                return 0;
            }
        }
        else if(cur==1){
            if(s[i]=='7'||s[i]=='8') cur=0;
            else if(s[i]=='3'||s[i]=='4'||s[i]=='5') cur=1;
            else if(i==0&&s[i]=='1') cur=0; 
            else{
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}
0