Submission #142499

#TimeUsernameProblemLanguageResultExecution timeMemory
142499KCSCKotrljanje (COCI18_kotrljanje)C++14
126 / 140
2052 ms2940 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; scanf("%d %d %d %d", &c, &d, &b, &m); long long aux = 1LL * c * (b - 1), aux1 = aux + d, aux2 = aux + d; for (int i = 1; i; i++, aux1 += aux) { int v = convert(aux1, b); ++frq[v]; if (frq[v] == m) { for (int j = 1; j <= i; ++j, aux2 += aux) if (convert(aux2, b) == v) printf("%lld ", 1LL * j * (b - 1)); break; } } return 0; }

Compilation message (stderr)

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d", &c, &d, &b, &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...