結果

問題 No.152 貯金箱の消失
ユーザー titiatitia
提出日時 2022-03-21 00:11:01
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 361 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 852,512 KB
最終ジャッジ日時 2024-04-16 17:20:51
合計ジャッジ時間 11,779 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# ピタゴラス数の列挙式、知らず。
# 検索するしかなさそうですね。

from math import gcd

N=int(input())
N//=4
LIST=set()

for m in range(1,5*10**3):
    for n in range(1,m):
        if gcd(m,n)==1 and m>n and m%2!=n%2:
            LIST.add((m*m-n*n,2*m*n,m*m+n*n))

ANS=0
for a,b,c in LIST:
    if a+b+c<=N:
        ANS+=1

print(ANS)
0