Submission #940799

#TimeUsernameProblemLanguageResultExecution timeMemory
940799rainboyCookie Clicker Alpha (GCJ14_cookie)C11
19 / 19
1 ms348 KiB
#include <math.h> #include <stdio.h> int main() { int t, _; scanf("%d", &t); for (_ = 1; _ <= t; _++) { double c, f, x, p, q, ans; int k, h; scanf("%lf%lf%lf", &c, &f, &x); p = (x - c) * f - c * 2, q = c * f; k = p < 0 ? 0 : ceil(p / q); ans = 0; for (h = 0; h < k; h++) ans += c / (f * h + 2); ans += x / (f * k + 2); printf("Case #%d: %.12f\n", _, ans); } return 0; }

Compilation message (stderr)

cookie.c: In function 'main':
cookie.c:7:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d", &t);
      |  ^~~~~~~~~~~~~~~
cookie.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%lf%lf%lf", &c, &f, &x);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...