結果

問題 No.152 貯金箱の消失
ユーザー rlangevinrlangevin
提出日時 2023-05-09 08:57:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 508 ms / 5,000 ms
コード長 368 bytes
コンパイル時間 2,293 ms
コンパイル使用メモリ 86,516 KB
実行使用メモリ 116,168 KB
最終ジャッジ日時 2023-08-17 03:43:36
合計ジャッジ時間 4,791 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,792 KB
testcase_01 AC 82 ms
76,240 KB
testcase_02 AC 80 ms
76,032 KB
testcase_03 AC 81 ms
76,076 KB
testcase_04 AC 94 ms
76,636 KB
testcase_05 AC 90 ms
76,740 KB
testcase_06 AC 93 ms
76,760 KB
testcase_07 AC 140 ms
80,808 KB
testcase_08 AC 501 ms
114,076 KB
testcase_09 AC 508 ms
116,168 KB
testcase_10 AC 409 ms
104,872 KB
testcase_11 AC 260 ms
90,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

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