結果

問題 No.653 E869120 and Lucky Numbers
ユーザー chocorusk
提出日時 2018-09-20 04:43:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 74,196 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 08:27:07
合計ジャッジ時間 1,503 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

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