Submission #142495

#TimeUsernameProblemLanguageResultExecution timeMemory
142495KCSCKotrljanje (COCI18_kotrljanje)C++14
14 / 140
2086 ms3500 KiB
#include <bits/stdc++.h> using namespace std; const int DIM = 50005; int frq[DIM]; int convert(long long x, int b) { int s = 0; for (; x; x /= b) s += x % b; return s; } int main(void) { // freopen("kotrljanje.in", "r", stdin); // freopen("kotrljanje.out", "w", stdout); int c, d, b, m; cin >> c >> d >> b >> m; for (long long i = 1; i; i = (i * c + d) % 1428571758241) { int v = convert(i * c + d, b); ++frq[v]; if (frq[v] == m) { for (long long j = 1; j; j = (j * c + d) % 1428571758241) { if (convert(j * c + d, b) == v) printf("%lld ", j); if (j == i) break; } break; } } return 0; }
#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...