結果

問題 No.736 約比
ユーザー URechaRechaURechaRecha
提出日時 2019-09-09 16:59:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 763 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 12,808 KB
最終ジャッジ日時 2023-09-10 21:38:34
合計ジャッジ時間 3,999 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 172 ms
12,808 KB
testcase_01 AC 19 ms
8,340 KB
testcase_02 AC 17 ms
8,052 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n=int(input())
e =list(map(int,input().split()))
def f(num):
    for i in range(n):
        e[i] //=num
bl2 = 1#2で約比可能か
bli = 1#3以上の奇数で約比可能か
#0番目の要素を約分
divs = []
a = e[0]
min_num=3
while bl2 or bli :
    if bl2:
        if a%2 ==0:
            a //=2
            divs.append(2)
            continue
        else:
            bl2 =0
    for i in range(min_num,int(math.sqrt(a))+1,2):
        if a%i ==0:
            a //=i
            divs.append(i)
            min_num=i
            continue
    else:
        bli =0
divs.append(a)
while len(divs) >0:
    bl =1
    d = divs.pop(0)
    for i in range(1,n):
        if e[i] % d >=1:
            bl =0
    if bl:
        f(d)
print(":".join(map(str,e)))
0