|
|
вернуться в форумtest #5 Послано Sperow 14 окт 2020 01:59 I can't find a problem Please, help my code (C++): #include <iostream> #include <string> using namespace std; int main() { int a, b, c, sum, sr, i, n; cin >> n; cin >> a >> b >> c; sum = 0; if (n == 3) { sum = a + b + c; sr = 2; } else { for (i = 3; i < n; i++) { if ((a + b + c) > sum) { sum = a + b + c; sr = i - 1; } a = b; b = c; cin >> c; } } cout << sum<< " "<<sr;
return 0; } |
|
|