QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95730#5577. AlchemyUsername#WA 2ms3404kbC++14614b2023-04-11 18:37:182023-04-11 18:37:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-11 18:37:20]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3404kb
  • [2023-04-11 18:37:18]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

void test_case() {
    int n, k, ans = 0;
    cin >> n >> k;
    int current = 0;
    for (int i = 1; i <= n; ++i) {
        int x = i, pw = 1;
        while (x) {
            pw = (10ll * pw) % k;
            x /= 10;
        }
        current = (1ll * pw * current + i) % k;
        ans += (current == 0);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
    test_case();
    // int tc; cin >> tc;
    // while (tc--) {
    //     test_case();
    // }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3356kb

input:

ioi

output:

0

result:

ok single line: '0'

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3404kb

input:

noi

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'