洛谷#18RE,代码源OJ#18显示个Dangerous Syscalls,所以是为什么
题目:abc181d
#include <bits/stdc++.h>
#define inf 1e18
#define el putchar('\n')
#define r0 return 0
#define fi first
#define se second
#define pi 3.14
#define int_inf 1e9
#define ll_inf 1e18
using namespace std;
typedef long long ll;
typedef string str;
str s;
int cnt[10] = {0};
inline bool f(int x) {
int p[10];
memset(p, 0, sizeof(p));
while (x) {
p[x % 10]++;
x /= 10;
}
for (int i = 0; i < 10; i++) {
if (p[i] > cnt[i]) {
r0;
}
}
return 1;
}
signed main(void) {
//std::ios::sync_with_stdio(false);
//cin.tie(0);
//cout.tie(0);
cin >> s;
if ((int)s.size() == 1) {
puts(s == "8" ? "Yes" : "No");
r0;
}
if ((int)s.size() == 2) {
int x = stoi(s);
if (x % 8 == 0) {
puts("Yes");
r0;
}
x = x / 10 + x % 10 * 10;
puts(x % 8 == 0 ? "Yes" : "No");
r0;
}
if (stoi(s) % 8 == 0) {
puts("Yes");
r0;
}
for (int i = 0; i < (int)s.size(); i++) {
cnt[s[i] - '0']++;
}
for (int i = 104; i < 1000; i += 8) {
if (f(i)) {
puts("Yes");
r0;
}
}
puts("No");
return 0;
}