結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
TAISA_
|
| 提出日時 | 2018-02-23 23:17:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,355 bytes |
| コンパイル時間 | 791 ms |
| コンパイル使用メモリ | 81,376 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 18:16:07 |
| 合計ジャッジ時間 | 1,847 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 10000
#define INF 1000000000
#define MAX 101
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int main() {
string s;
cin>>s;
int sl=s.length();
bool ans=true;
bool f=true;
for(int i=sl-1;i>=0;i--){
if(i==sl-1){
if(s[i]!='2'&&s[i]!='3'&&s[i]!='4'){
ans=false;
break;
}
}else{
if(f){
if(i==0){
if(s[i]!='1'&&s[i]!='8'&&s[i]!='7'){
ans=false;
break;
}
}else if(s[i]!='3'&&s[i]!='4'&&s[i]!='5'){
if(s[i]=='7'||s[i]=='8'){
f=false;
}else{
ans=false;
break;
}
}
}else{
if(s[i]!='6'&&s[i]!='7'){
ans=false;
break;
}
}
}
}
if(ans){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
TAISA_