結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
pin
|
| 提出日時 | 2018-02-24 13:23:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,548 bytes |
| コンパイル時間 | 623 ms |
| コンパイル使用メモリ | 84,136 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-13 08:20:47 |
| 合計ジャッジ時間 | 1,591 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:75:5: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
75 | if (ans) cout << "Yes" << endl;
| ^~
ソースコード
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const ll MOD = 1000000007;
const ll INF = 100000;
string s;
bool judge(){
int cnt = 0, cnt2 = 0;
for (int i = 0; i < s.size(); i++){
int d = s[i] - '0';
if (i == s.size() - 1){
if (d < 2 || 4 < d) return false;
}
if (d == 9) return false;
if (d == 8) cnt++;
if (d == 1) cnt2++;
}
if (cnt > 1 || cnt2 > 1) return false;
return true;
}
bool judge2(int L){
for (int i = L; i < s.size(); i++){
int d = s[i] - '0';
if (i == s.size() - 1){
if (d < 2 || 4 < d) return false;
}
else{
if (d < 3 || 5 < d) return false;
}
}
return true;
}
int main(void){
cin >> s;
if (!judge()){
cout << "No" << endl;
return 0;
}
bool ans;
if (s[0] == '1'){
if (s.size() == 1) ans = false;
else ans = judge2(1);
}
else{
for (int i = 0; i < s.size(); i++){
int d = s[i] - '0';
if (d < 6){
if (s[i - 1] == '6') ans = false;
else ans = judge2(i);
break;
}
}
}
if (ans) cout << "Yes" << endl;
else cout << "No" << endl;
}
pin