QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#426199 | #7606. Digital Nim | real_sigma_team# | WA | 1ms | 3816kb | C++20 | 1.0kb | 2024-05-30 22:32:55 | 2024-05-30 22:32:56 |
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: 100
Accepted
time: 1ms
memory: 3636kb
input:
4 1 10 42 190
output:
Algosia Bajtek Algosia Algosia
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
1 1
output:
Algosia
result:
ok single line: 'Algosia'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3816kb
input:
10000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
output:
Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia...
result:
wrong answer 1900th lines differ - expected: 'Bajtek', found: 'Algosia'