Submission #141227

#TimeUsernameProblemLanguageResultExecution timeMemory
141227mariusnicoliKotrljanje (COCI18_kotrljanje)C++14
126 / 140
2009 ms2920 KiB
#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; p = 1; while (p <= d) p*=b; for (i=1;;i++) { n = 1LL*c*i*(b-1)+d; suma = 0; while (n) { suma += n%b; n/=b; } mp[suma] ++; if (mp[suma] == m) { sol = suma; break; } ///} } for (i=1;m;i++) { n = 1LL*c*i*(b-1)+d; suma = 0; while (n) { suma += n%b; n/=b; } if (suma == sol) { cout<<i*(b-1)<<" "; m--; } ///} } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...