QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217482#5581. Champernowne CountViktor#WA 4ms3692kbC++14576b2023-10-16 21:44:442023-10-16 21:44:44

Judging History

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

  • [2023-10-16 21:44:44]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3692kb
  • [2023-10-16 21:44:44]
  • 提交

answer

#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int n,k,j,counter = 0;
    cin >> n >> k;      //Input

    long long actual_rest = 1ll;
    long long multiplicator_rest = (long long)(10ll % k);
    
    for (int i = 2; i <= n; i++) {
        j = i;
        while (j > 0) {
            actual_rest*=multiplicator_rest;
            actual_rest%=k;
            j /= 10;
        }
        actual_rest += (i % k);
        actual_rest %= k;
        if (!actual_rest) {
            counter++;
        }
    }
    cout << counter << endl;
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3680kb

input:

4 2

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

100 7

output:

14

result:

ok single line: '14'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

314 159

output:

4

result:

ok single line: '4'

Test #4:

score: 0
Accepted
time: 4ms
memory: 3624kb

input:

100000 999809848

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 4ms
memory: 3628kb

input:

100000 123

output:

161

result:

ok single line: '161'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

10000 123

output:

161

result:

ok single line: '161'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

123 123

output:

3

result:

ok single line: '3'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

123 2

output:

61

result:

ok single line: '61'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

9999 2

output:

4999

result:

ok single line: '4999'

Test #10:

score: -100
Wrong Answer
time: 0ms
memory: 3684kb

input:

1 1

output:

0

result:

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