๊ฐ์ฅ ๊ธด ํ๋ฌธ์ ๊ธธ์ด๋ฅผ ๊ตฌํ๋ ๋ฌธ์
๋์ ์ฝ๋
for _ in range(10):
t = int(input())
arr = []
result = 0
for _ in range(100):
arr.append(input())
for i in range(100):
b = [x[i] for x in arr]
for j in range(100):
for length in range(1,101):
if j+length > 100:
break
tmp1 = arr[i][j:j+length]
tmp2 = b[j:j+length]
if tmp1 == tmp1[::-1] and length > result:
result = length
if tmp2 == tmp2[::-1] and length > result:
result = length
print("#"+str(t) ,result )
3์ค for ๋ฌธ ์จ์ ์๊ฐ ์ด๊ณผ ๋์ฌ ์ค ์์๋๋ฐ ํต๊ณผ
๋ณดํต 1-5์ด ์๊ฐ์ ํ์ธ๋ฐ SWEA ๋ฌธ์ ๋ ํ์ด์ฌ์ ๊ฒฝ์ฐ 30์ด ์ ํ์ด๋ค.
์๊ฐ๋ณต์ก๋ ์๊ฐ์ํ๊ณ pass ๋ฅผ ๋ชฉ์ ์ผ๋ก ํ๋ค๋ฉด ์ด๋ ๊ฒ ํ์ด๋ ๋๋ ค๋,,?
๋ค๋ฅธ ํ์ด๋ณด๋ฉด ์๊ฐ๋ณต์ก๋๋ฅผ ์ค์ด๊ธฐ ์ํด
๋งจ ์ฒ์ ๋ฌธ์์ด์ ์ ๋ ๊ฐ์ด ๊ฐ์ ๋๋ง ์์ชฝ ํ์ธํ๊ธฐ -> ๋ค๋ฅด๋ฉด break
'Algorithm > SWEA' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SWEA - D3] 1213. String (0) | 2023.05.04 |
---|---|
[SWEA - D3] 1225. ์ํธ์์ฑ๊ธฐ (0) | 2023.05.04 |
[SWEA - D3] 1215. ํ๋ฌธ1 (0) | 2023.05.01 |
[SWEA - D3] 1217. ๊ฑฐ๋ญ ์ ๊ณฑ (0) | 2023.04.24 |
[SWEA - D3] 4406. ๋ชจ์์ด ๋ณด์ด์ง ์๋ ์ฌ๋ (0) | 2023.04.20 |