結果

問題 No.1143 面積Nの三角形
ユーザー tamatotamato
提出日時 2020-07-31 23:05:34
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,383 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 89,244 KB
最終ジャッジ日時 2023-09-21 02:08:21
合計ジャッジ時間 10,289 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,300 KB
testcase_01 AC 90 ms
76,508 KB
testcase_02 AC 91 ms
76,448 KB
testcase_03 AC 98 ms
76,572 KB
testcase_04 AC 98 ms
77,788 KB
testcase_05 AC 102 ms
76,984 KB
testcase_06 AC 111 ms
76,856 KB
testcase_07 AC 211 ms
78,164 KB
testcase_08 AC 379 ms
78,876 KB
testcase_09 AC 389 ms
79,008 KB
testcase_10 AC 252 ms
77,936 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 212 ms
77,108 KB
testcase_15 AC 75 ms
71,696 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    NN = 16*N*N
    memo = {}
    def divisors(n):
        if n in memo:
            return memo[n]

        ret = []
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                ret.append(i)
                ret.append(n // i)
        if ret[-1] * ret[-1] == n:
            ret.pop()
        ret.sort()
        memo[n] = ret
        return ret

    ans = 0
    div = divisors(NN)
    for L in div:
        if L**4 < NN:
            continue
        ABC = NN // L
        divABC = divisors(ABC)
        for A in divABC:
            if A**3 < ABC:
                continue
            BC = ABC // A
            divBC = divisors(BC)
            for B in divBC:
                if B**2 < BC:
                    continue
                C = BC // B

                # check
                if not A >= B >= C:
                    continue
                if not L%2 == A%2 == B%2 == C%2:
                    continue
                a = (L-A) // 2
                b = (L-B) // 2
                c = (L-C) // 2
                if not L == a+b+c:
                    continue
                if a + b <= c:
                    continue
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()
0