👑 [문제]
import sys
sys.stdin = open("input.txt")
T = int(input())
for tc in range(1, T+1):
N = int(input())
N_list = list(map(int,input().split())) # 2 3 8 9
max_num = 0
for i in range(len(N_list)): # 0 1 2 3
for j in range(i+1, len(N_list)): # 3 8 9 # 8 9 # 9
int_multi = 0
str_multi = []
int_multi = N_list[i]*N_list[j] # i:2, j:3, 8, 9 # i:3, j:8, 9 # i:8, j:9
str_multi += str(N_list[i]*N_list[j]) # '4'
for k in range(len(str_multi)-1): # 20
if str_multi[k] > str_multi[k+1]:
break
else:
if int_multi > max_num:
max_num = int_multi
if max_num == 0:
print("#{} {}".format(tc, -1))
else:
print("#{} {}".format(tc, max_num))
'# 3. APS > SWEA' 카테고리의 다른 글
SWEA # Python_D3_5178_노드의 합 (tree) (0) | 2021.04.08 |
---|---|
SWEA # Python_D3_5431_민석이의 과제 체크하기 (0) | 2021.03.14 |
SWEA # Python_D3_2805_농작물 수확하기 (0) | 2021.03.13 |
SWEA # Python_D2_1215_회문1 (0) | 2021.03.13 |
SWEA # Python_D2_1926_간단한 369게임 (0) | 2021.03.07 |