結果
問題 |
No.653 E869120 and Lucky Numbers
|
ユーザー |
|
提出日時 | 2018-02-23 22:34:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 591 ms |
コンパイル使用メモリ | 71,492 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-09 19:46:18 |
合計ジャッジ時間 | 1,558 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 5 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <string> using namespace std; int main() { string s; cin >> s; int carry = 0; int bad = 0; for (int i = s.size() - 1; i >= 0; i--) { for (int x : {0, 6, 7}) { for (int y : {0, 6, 7}) { if (bad == 1 && y != 0) continue; if (bad == 2 && (x != 0 || y != 0)) continue; if ((x + y + carry) % 10 == s[i] - '0') { if (x == 0) bad++; if (y == 0) bad++; carry = (x + y + carry) / 10; goto LP; } } } cout << "No" << endl; return 0; LP:; } if (carry == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } }