You are viewing a single comment's thread. Return to all comments →
"C++ Solution"
#include <iostream> using namespace std; int main(){ int size; cin >> size; int ar[size]; for (int i = 0; i < size; i++){ cin >> ar[i]; } int d, m; cin >> d >> m; int sum = 0; int count = 0; for (int i = 0; i < size; i++){ for (int j = i; j < m + i; j++){ sum += ar[j]; } if (sum == d){ count++; } sum = 0; } cout << count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →
"C++ Solution"