結果

問題 No.152 貯金箱の消失
ユーザー 👑 rin204rin204
提出日時 2022-07-09 16:24:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 76,284 KB
最終ジャッジ日時 2023-08-29 23:57:17
合計ジャッジ時間 2,785 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,400 KB
testcase_01 AC 73 ms
71,708 KB
testcase_02 AC 70 ms
71,600 KB
testcase_03 AC 69 ms
71,240 KB
testcase_04 AC 77 ms
76,148 KB
testcase_05 AC 77 ms
76,132 KB
testcase_06 AC 79 ms
76,080 KB
testcase_07 AC 95 ms
76,164 KB
testcase_08 AC 191 ms
76,264 KB
testcase_09 AC 190 ms
76,284 KB
testcase_10 AC 163 ms
76,104 KB
testcase_11 AC 127 ms
75,824 KB
権限があれば一括ダウンロードができます

ソースコード

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