#include <iostream>
#include <vector>
using namespace std;
long long n,c,d,b,m,x,i,sum,sol;
int f[30000];
vector <int> v[30000];
int main(){
cin>>c>>d>>b>>m;
x=3;
while(true){
n=c*x+d;
sum=0;
while(n){
sum+=n%b;
n/=b;
}
f[sum]++;
v[sum].push_back(x);
if(f[sum]==m){
sol=sum;
break;
}
x+=b-1;
}
for(i=0;i<m;i++)
cout<<v[sol][i]<<" ";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1148 KB |
Output is correct |
2 |
Incorrect |
80 ms |
5772 KB |
Expected unsigned integer, but "-2147481657" found |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
4492 KB |
Output is correct |
2 |
Correct |
53 ms |
4460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
4840 KB |
Output is correct |
2 |
Correct |
56 ms |
4584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
5008 KB |
Output is correct |
2 |
Correct |
59 ms |
4840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
5348 KB |
Output is correct |
2 |
Correct |
140 ms |
5804 KB |
Output is correct |
3 |
Correct |
74 ms |
5096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
5212 KB |
Output is correct |
2 |
Correct |
73 ms |
5344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
1492 KB |
Output is correct |
2 |
Correct |
430 ms |
4844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
966 ms |
8992 KB |
Output is correct |
2 |
Correct |
660 ms |
9908 KB |
Output is correct |
3 |
Correct |
1095 ms |
9916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
5644 KB |
Output is correct |
2 |
Correct |
542 ms |
8364 KB |
Output is correct |
3 |
Correct |
75 ms |
5484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
4988 KB |
Output is correct |
2 |
Correct |
68 ms |
4432 KB |
Output is correct |