QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#426198 | #7606. Digital Nim | real_sigma_team# | WA | 0ms | 3772kb | C++20 | 1.0kb | 2024-05-30 22:32:25 | 2024-05-30 22:32:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
bool dp[N];
int sum(long long n) {
int sum = 0;
while (n) sum += n % 10, n /= 10;
return sum;
}
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int tests;
cin >> tests;
while (tests--) {
long long n;
cin >> n;
if (n % 10 != 0) cout << "Algosia\n";
else {
n /= 10;
string s = to_string(n);
int sm = 0;
bool ok = false;
for (auto i : s) {
sm += i - '0';
ok &= sm >= 10 && sm % 2 == 0;
}
if (ok) cout << "Algosia\n";
else cout << "Bajtek\n";
}
}
return 0;
for (int i = 0; i < N; ++i) {
int sm = 0;
for (int x = i; x; sm += x % 10, x /= 10);
for (int j = i - sm / 10; j < i; ++j) if (!dp[j]) dp[i] = true;
}
for (int i = 0; i < 1000; ++i) {
if (dp[i]) cout << i << ' ' << sum(i) << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3772kb
input:
4 1 10 42 190
output:
Algosia Bajtek Algosia Bajtek
result:
wrong answer 4th lines differ - expected: 'Algosia', found: 'Bajtek'