#include <iostream>
using namespace std;
long long n,c,d,b,m,x,i,sum,sol,f[30000];
int main(){
cin>>c>>d>>b>>m;
x=3;
for(i=1;;i++){
n=c*x+d;
sum=0;
while(n){
sum+=n%b;
n/=b;
}
f[sum]++;
if(f[sum]==m){
sol=sum;
break;
}
x+=b-1;
}
x=3;
for(i=1;;i++){
n=c*x+d;
sum=0;
while(n){
sum+=n%b;
n/=b;
}
if(sum==sol){
m--;
cout<<x<<" ";
}
x+=b-1;
if(m==0)
break;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
98 ms |
2956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
2352 KB |
Output is correct |
2 |
Correct |
65 ms |
2424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
2460 KB |
Output is correct |
2 |
Correct |
70 ms |
2476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
2544 KB |
Output is correct |
2 |
Correct |
70 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
2748 KB |
Output is correct |
2 |
Correct |
224 ms |
2204 KB |
Output is correct |
3 |
Correct |
99 ms |
2680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
85 ms |
2768 KB |
Output is correct |
2 |
Correct |
88 ms |
2880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
360 KB |
Output is correct |
2 |
Correct |
807 ms |
1056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1815 ms |
1712 KB |
Output is correct |
2 |
Correct |
1205 ms |
2188 KB |
Output is correct |
3 |
Execution timed out |
2040 ms |
2008 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
168 ms |
2252 KB |
Output is correct |
2 |
Correct |
994 ms |
2248 KB |
Output is correct |
3 |
Correct |
94 ms |
2712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
2680 KB |
Output is correct |
2 |
Correct |
89 ms |
2268 KB |
Output is correct |