結果
問題 |
No.653 E869120 and Lucky Numbers
|
ユーザー |
![]() |
提出日時 | 2018-02-23 23:28:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 781 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 195,828 KB |
最終ジャッジ日時 | 2025-01-05 08:36:47 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool flag = false; bool ans = true; int check(int a) { if (a == 2 || a == 3 || a == 4) return 1; else if (!flag && a==7 || a == 6) { flag = true; return 0;} else if (flag && a==7 || a == 6) return 0; else return -1; } int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; vector<int> p; for (int i = 0;i < s.size();i++){ p.push_back(s[s.size() -i-1] - '0'); } p.push_back(0); for (int i = 0;i < s.size()-1;i++){ if (check(p[i]) >= 0) p[i+1] -= check(p[i]); else ans = false; } if (p[s.size() - 1] != 0 && p[s.size() - 1] != 6 && p[s.size() - 1] != 7) ans = false; cout << (ans? "Yes":"No") << endl; return 0; }