#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200000 + 37;
int a[maxn];
int cntdig(ll x, ll b){
int ret = 0;
while (x){
ret += (x % b);
x /= b;
}
return ret;
}
int main(){
ios_base::sync_with_stdio(false);
ll c, d, b, m;
cin >> c >> d >> b >> m;
ll t = 1;
while (t <= d)
t *= b;
t *= (b - 1);
int can;
for (int i = 1; ; i++){
ll x = c * t * i + d;
a[cntdig(x, b)] ++;
if (a[cntdig(x, b)] == m){
can = cntdig(x, b);
break;
}
}
for (int i = 1; m; i++){
ll x = c * t * i + d;
if (cntdig(x, b) == can){
cout << t * i << " ";
m --;
}
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
376 KB |
Unsigned integer 1000449200233980 violates the range [1, 1000000000000000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
80 ms |
3192 KB |
Output is correct |
2 |
Correct |
82 ms |
3192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
3320 KB |
Output is correct |
2 |
Correct |
86 ms |
3320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
89 ms |
3468 KB |
Output is correct |
2 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
3576 KB |
Output is correct |
2 |
Correct |
233 ms |
3328 KB |
Output is correct |
3 |
Correct |
108 ms |
4092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
376 KB |
Output is correct |
2 |
Correct |
882 ms |
1412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1871 ms |
2680 KB |
Output is correct |
2 |
Correct |
1237 ms |
3192 KB |
Output is correct |
3 |
Execution timed out |
2083 ms |
2680 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
140 ms |
2552 KB |
Output is correct |
2 |
Correct |
1124 ms |
3448 KB |
Output is correct |
3 |
Correct |
88 ms |
3580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |