Submission #837482

#TimeUsernameProblemLanguageResultExecution timeMemory
837482EntityPlanttPlanine (COCI21_planine)C++17
0 / 110
2 ms340 KiB
#include <cstdio> int n, h, i, c = 0; double st[500005], en[500005], x1, y1, x2, y2, x3, y3, l = -1e9; int main() { scanf("%d%d%lf%lf%lf%lf", &n, &h, &x3, &y3, &x3, &y3); if (n == 3) { printf("0"); return 0; } n = n / 2 - 1; for (i = 0; i < n; i++) { x1 = x3; y1 = y3; scanf("%lf%lf%lf%lf", &x2, &y2, &x3, &y3); st[i] = x1 + (h - y1) * (x1 - x2) / (y1 - y2); en[i] = x2 + (h - y2) * (x2 - x3) / (y2 - y3); } for (i = 0; i < n; i++) { if (l + 1e-9 < st[i]) { l = en[i]; c++; } } printf("%d", c); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d%d%lf%lf%lf%lf", &n, &h, &x3, &y3, &x3, &y3);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%lf%lf%lf%lf", &x2, &y2, &x3, &y3);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...