結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-25 12:57:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,345 bytes |
| コンパイル時間 | 1,716 ms |
| コンパイル使用メモリ | 167,740 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-27 03:20:24 |
| 合計ジャッジ時間 | 2,696 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 1 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
int dp[200005][10][2];
int main(){
string s;
cin >> s;
dp[0][0][0] = 1;
for(int i=0;i<s.size();i++){
int si = s[s.size()-i-1] - '0';
for(int j=0;j<10;j++){
if(dp[i][j][0]==1&&(j+6+6)%10==si){
dp[i+1][(j+6+6)/10][0] = 1;
}
if(dp[i][j][0]==1&&(j+7+6)%10==si){
dp[i+1][(j+7+6)/10][0] = 1;
}
if(dp[i][j][0]==1&&(j+7+7)%10==si){
dp[i+1][(j+7+7)/10][0] = 1;
}
if((dp[i][j][0]==1||dp[i][j][1]==1)&&(j+6)%10==si){
dp[i+1][(j+6)/10][1] = 1;
}
if((dp[i][j][0]==1||dp[i][j][1]==1)&&(j+7)%10==si){
dp[i+1][(j+7)/10][1] = 1;
}
}
}
/*
rep(i,s.size()+1){
rep(j,10){
cout << dp[i][j][0] << " " << dp[i][j][1] << " ";
}
cout << endl;
}
*/
cout << ((dp[s.size()-1][s[0]-'0'][0]==1||dp[s.size()][0][1]==1)?"Yes":"No") << endl;
return 0;
}