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>
#include <map>
using namespace std;
int mp[30000];
long long c, d, b, m, p, i, n, suma, sol;
int main () {
cin>>c>>d>>b>>m;
long long x = 3;
for (i=1;;i++) {
n = c*x+d;
suma = 0;
while (n) {
suma += n%b;
n/=b;
}
mp[suma] ++;
if (mp[suma] == m) {
sol = suma;
break;
}
x += (b-1);
}
x = 3;
for (i=1;m;i++) {
n = c*x+d;
suma = 0;
while (n) {
suma += n%b;
n/=b;
}
if (suma == sol) {
cout<<x<<" ";
m--;
}
x += (b-1);
}
}
# | 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... |