#include <iostream>
#include <vector>
#include <map>
using namespace std;
int mp[30000];
long long c, d, b, m, p, i, n, suma, sol;
int main () {
cin>>c>>d>>b>>m;
p = 1;
while (p <= d)
p*=b;
for (i=1;;i++) {
n = 1LL*c*i+d;
suma = 0;
while (n) {
suma += n%b;
n/=b;
}
mp[suma] ++;
if (mp[suma] == m) {
sol = suma;
break;
}
///}
}
for (i=1;m;i++) {
n = 1LL*c*i+d;
suma = 0;
while (n) {
suma += n%b;
n/=b;
}
if (suma == sol) {
cout<<i<<" ";
m--;
}
///}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
828 ms |
536 KB |
Output is correct |
2 |
Execution timed out |
2013 ms |
400 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2011 ms |
408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2070 ms |
404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2021 ms |
408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2032 ms |
396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2051 ms |
396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
440 KB |
Output is correct |
2 |
Correct |
804 ms |
976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1811 ms |
1820 KB |
Output is correct |
2 |
Correct |
1207 ms |
2272 KB |
Output is correct |
3 |
Execution timed out |
2023 ms |
1976 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1049 ms |
2248 KB |
Output is correct |
2 |
Correct |
928 ms |
2060 KB |
Output is correct |
3 |
Correct |
1177 ms |
2328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2025 ms |
404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |