結果

問題 No.1146 土偶Ⅰ
ユーザー brthyyjpbrthyyjp
提出日時 2020-12-21 07:07:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,392 KB
実行使用メモリ 75,648 KB
最終ジャッジ日時 2023-10-21 11:28:19
合計ジャッジ時間 3,014 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
55,496 KB
testcase_01 AC 48 ms
55,496 KB
testcase_02 AC 46 ms
55,496 KB
testcase_03 AC 68 ms
75,644 KB
testcase_04 AC 114 ms
75,648 KB
testcase_05 AC 69 ms
75,584 KB
testcase_06 AC 86 ms
75,644 KB
testcase_07 AC 103 ms
75,644 KB
testcase_08 AC 113 ms
75,648 KB
testcase_09 AC 82 ms
75,644 KB
testcase_10 AC 67 ms
75,640 KB
testcase_11 AC 86 ms
75,644 KB
testcase_12 AC 115 ms
75,648 KB
testcase_13 AC 46 ms
55,496 KB
testcase_14 AC 77 ms
75,648 KB
testcase_15 AC 104 ms
75,648 KB
testcase_16 AC 84 ms
75,584 KB
testcase_17 AC 46 ms
55,496 KB
testcase_18 AC 55 ms
65,920 KB
testcase_19 AC 80 ms
75,644 KB
testcase_20 AC 56 ms
63,872 KB
testcase_21 AC 61 ms
73,036 KB
testcase_22 AC 58 ms
68,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [int(input()) for i in range(n)]

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

import itertools
ans = 0
for c in itertools.combinations(A, 3):
    if gcd_list(c) == 1:
        ans += 1
print(ans)
0