結果

問題 No.2074 Product is Square ?
ユーザー k1suxu
提出日時 2022-09-16 23:50:31
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 188,928 KB
最終ジャッジ日時 2024-12-21 23:34:34
合計ジャッジ時間 63,191 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 RE * 2 TLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_square(apositiveint):
  x = apositiveint // 2
  seen = set([x])
  while x * x != apositiveint:
    x = (x + (apositiveint // x)) // 2
    if x in seen: return False
    seen.add(x)
  return True

t = int(input())

for i in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    mul = 1
    for e in a:
        mul *= e
    if is_square(mul):
        print("Yes")
    else:
        print("No")
0