⌨️

[AtCoder]ABC-175|B - Making Triangle

2023/03/20に公開

設問ページ

提出結果

import itertools


def getInt():
    return int(input())


def getIntList():
    return list(map(int, input().split()))


def main():
    n = getInt()
    l = getIntList()

    c = 0
    a = list(itertools.combinations(l, 3))
    for t in a:
        if len(set(t)) != 3:
            continue

        x, y, z = sorted(t)
        if x + y > z:
            c += 1
    print(c)


if __name__ == "__main__":
    main()

Discussion