This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |