結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2018-02-23 22:53:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 921 bytes |
| コンパイル時間 | 730 ms |
| コンパイル使用メモリ | 73,968 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 20:25:06 |
| 合計ジャッジ時間 | 1,577 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
string p;
cin >> p;
int n = p.size();
int b = 0, s = 0, c = 0;
for (int i = n - 1; i >= 0; i--) {
int k = p[i] - '0' - c;
if (s == 0) {
if (k < 2 || 4 < k) {
if (k == 6 || k == 7) {
s = 1;
c = 0;
} else if (k == 0) {
if (i != 0) b = 1;
c = 0;
} else {
b = 1;
}
} else {
c = 1;
}
} else {
if (k == 6 || k == 7) {
c = 0;
} else {
b = 1;
}
}
}
cout << (b == 0 && c == 0 ? "Yes" : "No") << endl;
return 0;
}
merom686