結果

問題 No.152 貯金箱の消失
ユーザー 👑 rin204
提出日時 2022-07-09 16:24:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 62,252 KB
最終ジャッジ日時 2024-12-31 03:45:32
合計ジャッジ時間 1,896 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
l = int(input()) // 4

lst = []
m = 2
ans = 0
while 1:
    if 2 * m * (m + 1) >= l:
        break
    n = 1
    while n < m and 2 * m * (m + n) <= l:
        a, b, c = m * m - n * n, 2 * m * n, m * m + n * n
        if gcd(gcd(a, b), c) == 1:
            ans += 1
        n += 1
    m += 1
print(ans)
0