Submission #75048

#TimeUsernameProblemLanguageResultExecution timeMemory
75048charlies_mooTelefoni (COCI17_telefoni)C++17
80 / 80
60 ms672 KiB
#include <iostream> using namespace std; int main() { int n, d; cin >> n >> d; int lt; int c = 0; for (int i = 0; i < n; i++) { int a; cin >> a; if (a == 1) { lt = i; } else if (i - lt == d) { lt = i; c++; } } cout << c << endl; return 0; }

Compilation message (stderr)

telefoni.cpp: In function 'int main()':
telefoni.cpp:15:22: warning: 'lt' may be used uninitialized in this function [-Wmaybe-uninitialized]
         } else if (i - lt == d) {
                    ~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...