結果

問題 No.2074 Product is Square ?
ユーザー k1suxuk1suxu
提出日時 2022-09-16 23:50:31
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 120,516 KB
最終ジャッジ日時 2023-08-23 17:06:58
合計ジャッジ時間 5,833 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,444 KB
testcase_01 AC 131 ms
77,048 KB
testcase_02 AC 129 ms
77,304 KB
testcase_03 AC 129 ms
77,028 KB
testcase_04 AC 145 ms
78,364 KB
testcase_05 AC 129 ms
77,076 KB
testcase_06 AC 130 ms
76,956 KB
testcase_07 AC 130 ms
76,908 KB
testcase_08 AC 132 ms
76,924 KB
testcase_09 AC 129 ms
77,008 KB
testcase_10 AC 146 ms
78,284 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

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