結果

問題 No.2074 Product is Square ?
ユーザー ecotteaecottea
提出日時 2022-09-16 22:50:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 583 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 78,852 KB
最終ジャッジ日時 2023-08-23 16:22:16
合計ジャッジ時間 6,351 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,304 KB
testcase_01 AC 205 ms
77,412 KB
testcase_02 AC 216 ms
77,124 KB
testcase_03 AC 220 ms
78,852 KB
testcase_04 AC 208 ms
77,044 KB
testcase_05 AC 205 ms
77,140 KB
testcase_06 AC 215 ms
77,096 KB
testcase_07 AC 209 ms
77,644 KB
testcase_08 AC 212 ms
77,316 KB
testcase_09 AC 209 ms
77,184 KB
testcase_10 AC 212 ms
77,124 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 #

# https://sky-time-math.hatenablog.jp/entry/2020/09/08/153230
def intsqrt(n):
    dig=0
    while pow(10,2*dig) < n:
        dig+=1
    
    sq=0
    for k in reversed(range(0,dig+1)):
        for l in range(0,10):
            sq+=10**k
            if sq*sq==n:
                break
            if sq*sq>n:
                sq-=10**k
                break
    return sq

t = int(input())

for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))

    p = 1
    for v in a:
        p *= v
        
    rt = intsqrt(p)
    print("Yes" if rt * rt == p else "No")
0