SWEA_1209) Sum
SWEA
# D3
1209) Sum (19.10.20)
문제 링크 (SW Expert Academy)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer tk;
for(int test=1; test<=10; test++) {
int t = Integer.parseInt(br.readLine());
int[][] map = new int[100][100];
int[] ans = new int[4];
int maxi = 0;
int maxx = 0;
int maxy = 0;
for(int i=0;i<100;i++) {
tk = new StringTokenizer(br.readLine());
int sum = 0;
int sumx = 0;
int sumy = 0;
for(int j=0;j<100;j++) {
map[i][j] = Integer.parseInt(tk.nextToken());
sum = sum+map[i][j];
if(i==j) sumx = sumx + map[i][j];
if(i+j==99) sumy = sumy+map[i][j];
}
if(maxi<sum) maxi = sum;
if(maxx<sumx) maxx = sumx;
if(maxy<sumy) maxy = sumy;
}
ans[0] = maxi;
ans[1] = maxx;
ans[2] = maxy;
int maxj = 0;
for(int j=0;j<100;j++) {
int sumj = 0;
for(int i=0;i<100;i++) {
sumj = sumj+map[i][j];
}
if(maxj<sumj) maxj = sumj;
}
ans[3] = maxj;
Arrays.sort(ans);
bw.write("#" + t + " " + ans[3] + "\n");
}
bw.flush();
bw.close();
}
}
| cs |
댓글
댓글 쓰기