結果

問題 No.152 貯金箱の消失
ユーザー lloyzlloyz
提出日時 2023-06-16 00:32:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 526 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 116,008 KB
最終ジャッジ日時 2023-09-06 02:25:58
合計ジャッジ時間 3,635 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,072 KB
testcase_01 AC 81 ms
76,100 KB
testcase_02 AC 76 ms
75,868 KB
testcase_03 AC 80 ms
76,028 KB
testcase_04 AC 88 ms
76,488 KB
testcase_05 AC 90 ms
76,580 KB
testcase_06 AC 92 ms
76,648 KB
testcase_07 AC 142 ms
81,188 KB
testcase_08 AC 526 ms
113,940 KB
testcase_09 AC 524 ms
116,008 KB
testcase_10 AC 424 ms
105,020 KB
testcase_11 AC 261 ms
90,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

l = int(input())
ans = set()
for m in range(10**4 + 1):
    for n in range(1, m):
        if 8 * m * (m + n) > l:
            break
        L = [m**2 - n**2, 2 * m * n, m**2 + n**2]
        g = gcd(L[0], gcd(L[1], L[2]))
        L.sort()
        for i in range(3):
            L[i] //= g
        ans.add(tuple(L))
print(len(ans) % 1000003)
0