結果

問題 No.152 貯金箱の消失
ユーザー ntuda
提出日時 2025-02-03 20:28:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 183 ms / 5,000 ms
コード長 356 bytes
コンパイル時間 749 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 61,440 KB
最終ジャッジ日時 2025-02-03 20:28:42
合計ジャッジ時間 2,837 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
L = int(input())
L4 = L // 4
L82 = int((L//2) ** 0.5) + 1
m = 2
ans = 0
MOD = 1000003
while m <= L82:
    for n in range(m):
        if m % 2 == n % 2:
            continue
        if gcd(m,n) != 1:
            continue
        l = 2 * m * (m + n)
        if L4 >= l:
            ans += 1
            ans %= MOD
    m += 1
print(ans)

0