結果

問題 No.152 貯金箱の消失
コンテスト
ユーザー fmhr
提出日時 2026-10-10 01:42:33
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 168 ms / 5,000 ms
+ 429µs
コード長 326 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 381 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-10-10 01:42:54
合計ジャッジ時間 2,253 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math

L = int(input())
ans = 0

for m in range(1, int(math.sqrt(L//4)+1), 1):
    for n in range(1, m, 1):
        if (m-n) % 2 == 1:
            if ((m**2+n**2)+(2*m*n)+(m**2-n**2))*4 <= L:
                if math.gcd(m, n) == 1:
                    ans += 1
            else:
                break

print(ans%1000003)
0