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>
using namespace std;
long long c,d,b,m,nr,s;
long long f[30000];
int main(){
cin>>c>>d>>b>>m;
long long x=3;
long long suma;
while(1==1){
nr=c*x+d;
suma=0;
while(nr){
suma+=nr%b;
nr/=b;
}
f[suma]++;
if(f[suma]==m){
s=suma;
break;
}
x+=b-1;
}
x=3;
while(1==1){
nr=c*x+d;
suma=0;
while(nr){
suma+=nr%b;
nr/=b;
}
if(suma==s){
m--;
cout<<x<<" ";
}
x+=b-1;
if(m==0)
break;
}
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... |