#include <bits/stdc++.h>
using namespace std;
const int DIM = 50005;
int frq[DIM];
int convert(long long x, int b) {
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;
cin >> c >> d >> b >> m;
for (int i = 92852635; i; ++i) {
int v = convert(1LL * c * i + d, b);
++frq[v];
if (frq[v] == m) {
for (int j = 92852635; j <= i; ++j)
if (convert(1LL * c * j + d, b) == v)
printf("%d ", j);
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1199 ms |
632 KB |
Output is correct |
2 |
Execution timed out |
2099 ms |
476 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2025 ms |
504 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2052 ms |
504 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2037 ms |
532 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2060 ms |
396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2061 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
104 ms |
504 KB |
Output is correct |
2 |
Correct |
1159 ms |
1256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2027 ms |
1816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1402 ms |
2660 KB |
Output is correct |
2 |
Correct |
1245 ms |
2552 KB |
Output is correct |
3 |
Correct |
1773 ms |
2680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2060 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |