結果

問題 No.1146 土偶Ⅰ
ユーザー syunsukesyunsuke
提出日時 2020-11-02 08:37:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 77,316 KB
最終ジャッジ日時 2023-09-29 11:43:45
合計ジャッジ時間 4,091 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,344 KB
testcase_01 AC 70 ms
71,288 KB
testcase_02 AC 77 ms
75,024 KB
testcase_03 AC 99 ms
77,060 KB
testcase_04 AC 161 ms
76,956 KB
testcase_05 AC 99 ms
77,316 KB
testcase_06 AC 119 ms
77,088 KB
testcase_07 AC 143 ms
76,944 KB
testcase_08 AC 154 ms
77,092 KB
testcase_09 AC 108 ms
77,096 KB
testcase_10 AC 94 ms
77,152 KB
testcase_11 AC 117 ms
77,088 KB
testcase_12 AC 155 ms
77,188 KB
testcase_13 AC 69 ms
71,436 KB
testcase_14 AC 108 ms
77,192 KB
testcase_15 AC 140 ms
77,004 KB
testcase_16 AC 114 ms
77,148 KB
testcase_17 AC 70 ms
71,280 KB
testcase_18 AC 80 ms
75,888 KB
testcase_19 AC 109 ms
77,128 KB
testcase_20 AC 78 ms
75,988 KB
testcase_21 AC 93 ms
77,016 KB
testcase_22 AC 88 ms
76,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

def gcd3(a,b,c):
    if b>a:
        a,b=b,a
    while a%b!=0:
        a,b=b,a%b
    if c>b:
        b,c=c,b
    while b%c!=0:
        b,c=c,b%c
    return c

L=[]
for i in range(N):
    n=int(input())
    L.append(n)
ans=0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if gcd3(L[i],L[j],L[k])==1:
                ans+=1
print(ans)
0