結果

問題 No.2074 Product is Square ?
ユーザー shobonvip
提出日時 2022-09-16 21:48:34
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 439 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 82,000 KB
実行使用メモリ 162,048 KB
最終ジャッジ日時 2024-12-21 19:03:02
合計ジャッジ時間 63,950 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 TLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def issquared(n):
    suki = n
    kirai = 0
    while suki - kirai > 1:
        targ = (suki + kirai)//2
        if targ ** 2 >= n:
            suki = targ
        else:
            kirai = targ
    if suki ** 2 == n:
        return True
    return False

T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int,input().split()))
	d = 1
	for i in range(n):
		d *= a[i]
	if issquared(d):
		print("Yes")
	else:
		print("No")
0