QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#746110#5581. Champernowne Counti24WA 1ms3696kbC++141.2kb2024-11-14 13:28:122024-11-14 13:28:12

Judging History

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

  • [2024-11-14 13:28:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3696kb
  • [2024-11-14 13:28:12]
  • 提交

answer

// File generated on 24/11/13 21:19 by Anand

#include <bits/stdc++.h>
using namespace std;

#define fastio ios::sync_with_stdio(false); cin.tie(0)
#define rep(i, m, n)  for (long long i = m; i < n; i++)
#define DEBUG(x) cout << "debug: " << x << "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define pb push_back
#define sz size

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vec;
typedef vector<vec> vecc;
typedef vector<pll> vecp;

void SOLVE() {
    ll n, k;
    cin >> n >> k;
    ll c = 0;
    ll x = 1;
    ll m = 0;
    rep(i,1,min(10ll, n+1)) {
        m = (m * 10 + i) % k;
        if (m%k == 0) c++;  
    }

    rep(i, 10, min(100ll, n+1)) {
        m = (m * 100 + i) % k;
        if (m%k == 0) c++;
    }

    rep(i, 100, min(1000ll, n+1)) {
        m = (m * 1000 + i) % k;
        if (m%k == 0) c++;
    }

    rep(i, 1000, min(10000ll, n+1)) {
        m = (m * 10000 + i) % k;
        if (m%k == 0) c++;
    }

    rep(i, 10000, min(100000ll, n+1)) {
        m = (m * 100000 + i) % k;
        if (m%k == 0) c++;
    }

    cout << c << "\n";
}

signed main() {
    fastio;

		SOLVE();

    return 0;
}


详细

Test #1:

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

input:

4 2

output:

2

result:

ok single line: '2'

Test #2:

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

input:

100 7

output:

14

result:

ok single line: '14'

Test #3:

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

input:

314 159

output:

4

result:

ok single line: '4'

Test #4:

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

input:

100000 999809848

output:

1

result:

ok single line: '1'

Test #5:

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

input:

100000 123

output:

161

result:

ok single line: '161'

Test #6:

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

input:

10000 123

output:

161

result:

ok single line: '161'

Test #7:

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

input:

123 123

output:

3

result:

ok single line: '3'

Test #8:

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

input:

123 2

output:

61

result:

ok single line: '61'

Test #9:

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

input:

9999 2

output:

4999

result:

ok single line: '4999'

Test #10:

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

input:

1 1

output:

1

result:

ok single line: '1'

Test #11:

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

input:

1 2

output:

0

result:

ok single line: '0'

Test #12:

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

input:

2 1

output:

2

result:

ok single line: '2'

Test #13:

score: -100
Wrong Answer
time: 1ms
memory: 3544kb

input:

100000 1

output:

99999

result:

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