Submission #23097

#TimeUsernameProblemLanguageResultExecution timeMemory
23097model_codeTelefoni (COCI17_telefoni)C++11
80 / 80
23 ms1116 KiB
#include <cstdio> #include <string> #include <vector> #include <map> #include <cstdlib> #include <algorithm> #include <cstring> using namespace std; typedef long long llint; typedef pair <int, int> pii; int n, d; int main (void){ scanf("%d%d", &n, &d); int last = 0; int ans = 0; for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); if (x == 1) last = i; if (i - last == d) { ++ans; last = i; } } printf("%d\n", ans); return 0; }

Compilation message (stderr)

telefoni.cpp: In function 'int main()':
telefoni.cpp:17:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &n, &d);
                        ^
telefoni.cpp:21:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int x; scanf("%d", &x);
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...