結果
| 問題 | No.653 E869120 and Lucky Numbers |
| コンテスト | |
| ユーザー |
e869120
|
| 提出日時 | 2017-12-27 20:13:34 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 824µs | |
| コード長 | 1,116 bytes |
| 記録 | |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 74,496 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-26 09:34:25 |
| 合計ジャッジ時間 | 1,932 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
string S; bool I = false; int cx = 0;
int main() {
cin >> S; if (S[0] == '1') { I = true; cx = 1; }
if (S[0] == '2' || S[0] == '3' || S[0] == '4' || S[0] == '5' || S[0] == '9') { cout << "No" << endl; return 0; }
for (int i = cx; i < (int)S.size() - 1; i++) {
if (I == false) {
if (S[i] == '7')continue;
if (S[i] == '6') {
if (i == S.size() - 1)continue;
if (S[i + 1] == '6' || S[i + 1] == '7' || S[i + 1] == '8')continue;
cout << "No" << endl; return 0;
}
if (S[i] == '8') {
if (i == S.size() - 1)continue;
if (S[i + 1] == '3' || S[i + 1] == '4' || S[i + 1] == '5') { continue; }
cout << "No" << endl; return 0;
}
if (S[i] == '3' || S[i] == '4' || S[i] == '5') { I = true; }
else { cout << "No" << endl; return 0; }
}
if (I == true) {
if (S[i] == '3' || S[i] == '4' || S[i] == '5') { continue; }
else { cout << "No" << endl; return 0; }
}
}
if (S[S.size() - 1] == '2' || S[S.size() - 1] == '3' || S[S.size() - 1] == '4') { cout << "Yes" << endl; }
else { cout << "No" << endl; }
return 0;
}
e869120