QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426198#7606. Digital Nimreal_sigma_team#WA 0ms3772kbC++201.0kb2024-05-30 22:32:252024-05-30 22:32:26

Judging History

你现在查看的是最新测评结果

  • [2024-05-30 22:32:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3772kb
  • [2024-05-30 22:32:25]
  • 提交

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'