結果
問題 |
No.653 E869120 and Lucky Numbers
|
ユーザー |
|
提出日時 | 2018-02-24 00:08:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 765 bytes |
コンパイル時間 | 825 ms |
コンパイル使用メモリ | 75,516 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 05:21:04 |
合計ジャッジ時間 | 1,564 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <queue> #include <stack> using namespace std; int main(){ string s; cin >> s; int last = s[s.length() - 1] - '0'; if (!(last == 2 || last == 3 || last == 4)) cout << "No" << endl; bool c = true; int current; for (int i = s.length() - 2; i>-1; i--) { current = s[i] - '0'; if(!c) { if (!(current == 6 || current == 7)) { cout << "No" << endl; return 0; } } else { if (!(current == 3 || current == 4 || current == 5)) { if (i==0 && (current == 7 || current == 8)) { cout << "Yes" << endl; return 0; } c = false; } } } cout << "Yes" << endl; }