๋์ ์ฝ๋
for _ in range(10):
t = int(input())
arr = []
for _ in range(100):
tmp = list(map(int,input().split()))
arr.append(tmp)
large = 0
c = []
d = []
for i in range(100):
if sum(arr[i]) > large :
large = sum(arr[i])
b = [j[i] for j in arr]
if sum(b) > large :
large = sum(b)
c.append(arr[i][i])
d.append(arr[i][99-i])
result = max(large,sum(c),sum(d))
print("#"+str(t) , result)
ํ, ์ด, ๋๊ฐ์ 1, ๋๊ฐ์ 2
๊ฐ๊ฐ ์ต๋๊ฐ์ 4๋ฒ ๊ตฌํ๊ณ ๊ฐ์ฅ ํฐ ๊ฐ์ ์ถ๋ ฅ
๋ค๋ฅธ ํ์ด
for _ in range(10):
t=int(input())
arr=[list(map(int,input().split())) for _ in range(100)]
res=v3=v4=0
for i in range(100):
v1=v2=0
for j in range(100):
v1+=arr[i][j]
v2+=arr[j][i]
res=max(res,v1,v2)
v3+=arr[i][i]
v4+=arr[i][99-i]
res=max(res,v3,v4)
print("#"+str(t) , res)
'Algorithm > SWEA' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SWEA - D3] 5431. ๋ฏผ์์ด์ ๊ณผ์ ์ฒดํฌํ๊ธฐ (0) | 2023.05.09 |
---|---|
[SWEA - D3] 2805. ๋์๋ฌผ ์ํํ๊ธฐ (0) | 2023.05.09 |
[SWEA - D3] 1234. ๋น๋ฐ๋ฒํธ (0) | 2023.05.08 |
[SWEA - D3] 3456. ์ง์ฌ๊ฐํ ๊ธธ์ด ์ฐพ๊ธฐ (0) | 2023.05.07 |
[SWEA - D3] 1230. ์ํธ๋ฌธ3 (0) | 2023.05.07 |