Submission #475049

#TimeUsernameProblemLanguageResultExecution timeMemory
475049rainboyTimovi (COCI18_timovi)C11
80 / 80
20 ms2124 KiB
#include <stdio.h> #define N 200000 int main() { static int aa[N]; int n, k, m, r, i; scanf("%d%d%d", &n, &k, &m); r = m / (n - 1) / 2 / k; for (i = 0; i < n; i++) aa[i] = r * k * (i == 0 || i == n - 1 ? 1 : 2); m -= r * (n - 1) * 2 * k; for (i = 0; i < n - 1; i++) if (m >= k) aa[i] += k, m -= k; else { aa[i] += m, m = 0; break; } for (i = n - 1; i > 0; i--) if (m >= k) aa[i] += k, m -= k; else { aa[i] += m, m = 0; break; } for (i = 0; i < n; i++) printf("%d ", aa[i]); printf("\n"); return 0; }

Compilation message (stderr)

timovi.c: In function 'main':
timovi.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d%d%d", &n, &k, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...