#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 (long long i = 1; i; i = (i * c + d) % 1428571758241) {
int v = convert(i * c + d, b);
++frq[v];
if (frq[v] == m) {
for (long long j = 1; j; j = (j * c + d) % 1428571758241) {
if (convert(j * c + d, b) == v)
printf("%lld ", j);
if (j == i)
break;
}
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2036 ms |
760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2007 ms |
428 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2021 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2057 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2029 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2064 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
194 ms |
388 KB |
Output is correct |
2 |
Correct |
1917 ms |
1700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2049 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1093 ms |
2424 KB |
Output is correct |
2 |
Execution timed out |
2086 ms |
3500 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2060 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |