1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <iostream> #include <algorithm> using namespace std; int n, m; int a[1005],b[1005]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; int sum = 0; int clearMaxID = 0; for (int i = 0; i < n; i++) { cin >> a[i]; int t; for (int j = 0; j < m; j++) { cin >> t; b[i] += t; } sum += a[i] + b[i]; if (b[i] < b[clearMaxID]) clearMaxID = i; } cout << sum << " " << clearMaxID + 1 << " " << -b[clearMaxID]; } |
CSP 201909-1 小明种苹果
发表评论