結果

問題 No.1146 土偶Ⅰ
ユーザー ああいいああいい
提出日時 2021-12-06 13:57:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-21 15:15:24
合計ジャッジ時間 3,203 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,912 KB
testcase_01 AC 17 ms
7,900 KB
testcase_02 AC 17 ms
7,984 KB
testcase_03 AC 44 ms
7,788 KB
testcase_04 AC 239 ms
7,876 KB
testcase_05 AC 52 ms
7,872 KB
testcase_06 AC 129 ms
7,932 KB
testcase_07 AC 198 ms
7,832 KB
testcase_08 AC 241 ms
7,800 KB
testcase_09 AC 86 ms
7,900 KB
testcase_10 AC 37 ms
7,844 KB
testcase_11 AC 114 ms
7,900 KB
testcase_12 AC 244 ms
7,900 KB
testcase_13 AC 17 ms
7,844 KB
testcase_14 AC 82 ms
7,800 KB
testcase_15 AC 204 ms
7,760 KB
testcase_16 AC 101 ms
7,964 KB
testcase_17 AC 16 ms
7,760 KB
testcase_18 AC 19 ms
7,872 KB
testcase_19 AC 89 ms
7,896 KB
testcase_20 AC 18 ms
7,956 KB
testcase_21 AC 36 ms
7,764 KB
testcase_22 AC 26 ms
7,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(input()) for _ in range(n)]

def gcd(x,y):
    while True:
        r = x % y
        x = y
        y = r
        if r == 0:
            return x

count = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j + 1,n):
            if gcd(gcd(a[i],a[j]),a[k]) == 1:count += 1
print(count)
0