結果

問題 No.1146 土偶Ⅰ
ユーザー komkompikomkompi
提出日時 2020-10-18 08:52:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 10,616 KB
実行使用メモリ 8,032 KB
最終ジャッジ日時 2023-09-28 08:48:30
合計ジャッジ時間 2,422 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,920 KB
testcase_01 AC 16 ms
7,920 KB
testcase_02 AC 16 ms
8,032 KB
testcase_03 AC 23 ms
7,972 KB
testcase_04 AC 63 ms
7,920 KB
testcase_05 AC 25 ms
7,924 KB
testcase_06 AC 40 ms
7,992 KB
testcase_07 AC 55 ms
7,924 KB
testcase_08 AC 62 ms
7,980 KB
testcase_09 AC 31 ms
7,916 KB
testcase_10 AC 20 ms
7,924 KB
testcase_11 AC 37 ms
7,904 KB
testcase_12 AC 63 ms
7,896 KB
testcase_13 AC 16 ms
7,920 KB
testcase_14 AC 30 ms
7,948 KB
testcase_15 AC 57 ms
7,916 KB
testcase_16 AC 35 ms
7,960 KB
testcase_17 AC 16 ms
7,928 KB
testcase_18 AC 16 ms
8,028 KB
testcase_19 AC 32 ms
7,920 KB
testcase_20 AC 17 ms
7,964 KB
testcase_21 AC 20 ms
7,988 KB
testcase_22 AC 18 ms
7,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import math

N=int(input())
A=[]

for _ in range(N):
    A.append(int(input()))
    
#print(A)

ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        gcd_2=math.gcd(A[i],A[j])
        for k in range(j+1,N):
            gcd_3=math.gcd(gcd_2,A[k])
            if gcd_3==1:
                ans+=1

print(ans)
0