QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#217482 | #5581. Champernowne Count | Viktor# | WA | 4ms | 3692kb | C++14 | 576b | 2023-10-16 21:44:44 | 2023-10-16 21:44:44 |
Judging History
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'