Submission #239072

#TimeUsernameProblemLanguageResultExecution timeMemory
239072NONAMEKotrljanje (COCI18_kotrljanje)C++14
42 / 140
2092 ms2296 KiB
#include <iostream> #include <vector> #include <queue> #include <fstream> #include <algorithm> using namespace std; using ll = long long; const int N = 2e5 + 10; const ll oo = 1e18; ll c, d, b, m, cnt[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> c >> d >> b >> m; int p = 1; while (1) { ll v = c * p + d; int sm = 0; while (v > 0) { sm += v % b; v /= b; } cnt[sm]++; if (cnt[sm] == m) { for (int i = 0; i <= p; ++i) { ll v2 = c * i + d; int sm2 = 0; while (v2 > 0) { sm2 += v2 % b; v2 /= b; } if (sm2 == sm) cout << i << ' '; } break; } p++; } }
#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...