# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
142502 | KCSC | Kotrljanje (COCI18_kotrljanje) | C++14 | 1120 ms | 10452 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int DIM = 50005;
int frq[DIM];
vector<int> lst[DIM];
int _b;
int convert(long long x) {
int s = 0;
for (; x; x /= _b)
s += x % _b;
return s;
}
int main(void) {
/// freopen("kotrljanje.in", "r", stdin);
/// freopen("kotrljanje.out", "w", stdout);
int c, d, b, m;
scanf("%d %d %d %d", &c, &d, &b, &m);
long long aux = 1LL * c * (b - 1), aux1 = aux + d; _b = b;
for (int i = 1; i; i++, aux1 += aux) {
int v = convert(aux1);
++frq[v];
lst[v].push_back(i);
if (frq[v] == m) {
for (int x : lst[v])
printf("%lld ", 1LL * x * (b - 1));
break;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |