QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323294 | #5581. Champernowne Count | qyockey | WA | 0ms | 3664kb | C++14 | 958b | 2024-02-09 07:06:48 | 2024-02-09 07:06:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define lrep(i, a, b) for (ll i = a; i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define ia(n) std::array<int, n>
#define lla(n) std::array<ll, n>
using vi = std::vector<int>;
using pii = std::pair<int, int>;
using ll = long long;
using vll = std::vector<ll>;
using pll = std::pair<ll, ll>;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll word = 0;
ll power = 10;
ll count = 0;
ll n;
ll k;
cin >> n >> k;
lrep (i, 1, n) {
if (i == power) {
power *= 10;
}
word = ((word * power) + i) % k;
if (word == 0) {
++count;
}
}
cout << count << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3664kb
input:
4 2
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'