-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path1209_Sum.cpp
36 lines (30 loc) · 898 Bytes
/
1209_Sum.cpp
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
28
29
30
31
32
33
34
35
36
#include<iostream>
using namespace std;
int arr[101][101];
int main(int argc, char** argv)
{
int T = 10;
for (int test_case = 1; test_case <= T; ++test_case) {
cin >> test_case;
for (int i = 0; i < 100; i++) {
arr[100][i] = arr[i][100] = 0;
}
int diag = 0;
int diag2 = 0;
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
cin >> arr[i][j];
if (i == j) diag += arr[i][j];
if (i + j == 99) diag2 += arr[i][j];
arr[i][100] += arr[i][j];
arr[100][j] += arr[i][j];
}
}
int answer = max(diag, diag2);
for (int i = 0; i < 100; i++) {
answer = max(answer, max(arr[i][100], arr[100][i]));
}
cout << "#" << test_case << " " << answer << "\n";
}
return 0;
}