結果

問題 No.653 E869120 and Lucky Numbers
ユーザー square1001square1001
提出日時 2018-02-23 22:33:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 865 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 85,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 12:29:40
合計ジャッジ時間 5,202 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 27 ms
5,376 KB
testcase_02 AC 23 ms
5,376 KB
testcase_03 AC 52 ms
5,376 KB
testcase_04 AC 16 ms
5,376 KB
testcase_05 AC 16 ms
5,376 KB
testcase_06 AC 18 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 85 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1,031 ms
5,376 KB
testcase_29 AC 1,033 ms
5,376 KB
testcase_30 AC 1,017 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0