Submission #200158

#TimeUsernameProblemLanguageResultExecution timeMemory
200158SaboonKotrljanje (COCI18_kotrljanje)C++14
70 / 140
2085 ms4088 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 100000 + 37; int a[maxn]; int cntdig(ll x, ll b){ int ret = 0; while (x){ ret += (x % b); x /= b; } return ret; } int main(){ ios_base::sync_with_stdio(false); ll c, d, b, m; cin >> c >> d >> b >> m; ll t = 1; while (t <= d) t *= b; t *= (b - 1); int can; for (int i = 1; ; i++){ ll x = c * t * i + d; a[cntdig(x, b)] ++; if (a[cntdig(x, b)] == m){ can = cntdig(x, b); break; } } for (int i = 1; m; i++){ ll x = c * t * i + d; if (cntdig(x, b) == can){ cout << t * i << " "; m --; } } cout << endl; }
#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...