結果
問題 | No.653 E869120 and Lucky Numbers |
ユーザー |
![]() |
提出日時 | 2018-02-23 22:33:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 865 bytes |
コンパイル時間 | 912 ms |
コンパイル使用メモリ | 85,304 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 20:22:36 |
合計ジャッジ時間 | 5,550 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 1 |
ソースコード
#include <cmath>#include <string>#include <vector>#include <iomanip>#include <iostream>#include <algorithm>#include <functional>using namespace std;int n, a[20009], b[20009]; string s;int main() {cin >> s; n = s.size();for (int i = 0; i < n; i++) a[n - i - 1] = s[i] - 48;bool ret = false;for (int i = 1; i < n; i++) {for (int j = 0; j <= n; j++) b[j] = a[j];for (int j = 0; j < i; j++) b[j] -= 12;for (int j = i; j < (i == n - 1 ? n - 1 : n); j++) b[j] -= 6;for (int j = 0; j < n; j++) {int d = 0;if (b[j] < 0) d = (-b[j] + 9) / 10;b[j] += d * 10;b[j + 1] -= d;}if (b[n] >= 0) {bool f = true;for (int j = 0; j < i; j++) {if (b[j] >= 3) f = false;}for (int j = i; j < n; j++) {if (b[j] >= 2) f = false;}if (f) ret = true;}}cout << (ret ? "Yes" : "No") << endl;return 0;}