Die Zuckerbäckerin
Detaylar
#include <bits/stdc++> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } // Find the maximum sum of k consecutive elements int max_sum = 0; for (int i = 0; i + k - 1 < n; i++) { int sum = 0; for (int j = i; j < i + k; j++) { sum += a[j]; } max_sum = max(max_sum, sum); } cout << max_sum << endl; return 0; }
Film Detayları
0 Dk
12-03-1972
Deutsch
0 $
0 $
Önerilenler
Önerilen Filmler
01-07-1936
- 8 dk
01-01-1989
- 0 dk
24-10-1985
- 104 dk
10-05-1950
- 92 dk
Yorumlar (0)