結果

問題 No.653 E869120 and Lucky Numbers
ユーザー chocoruskchocorusk
提出日時 2018-09-20 04:41:04
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 72,980 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 10:24:30
合計ジャッジ時間 1,928 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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') cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}
0