Код:
#include <fstream>#include <vector>#include <numeric>int main() { std::ifstream cin("input.txt"); std::ofstream cout("output.txt"); int N, K; cin >> N >> K; std::vector<int> buffer(N); for (int i = 0; i < K; ++i) { for (int j = 0; j < N; ++j) { cin >> buffer[j]; } // Зануляем найденные min и max *(std::min_element(buffer.begin(), buffer.end())) = 0; *(std::max_element(buffer.begin(), buffer.end())) = 0; // Суммируем cout << std::accumulate(buffer.begin(), buffer.end(), 0) << "\n"; } return 0;}
2
4
все что нужно просто квалрат и яблоко нас так учили)))