結果

問題 No.152 貯金箱の消失
ユーザー kurimupykurimupy
提出日時 2020-06-21 02:39:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 356 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 112,328 KB
最終ジャッジ日時 2023-09-16 18:00:43
合計ジャッジ時間 3,359 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,264 KB
testcase_01 AC 76 ms
76,368 KB
testcase_02 AC 68 ms
71,288 KB
testcase_03 AC 76 ms
76,392 KB
testcase_04 AC 89 ms
76,512 KB
testcase_05 AC 86 ms
76,724 KB
testcase_06 AC 87 ms
76,724 KB
testcase_07 AC 125 ms
83,336 KB
testcase_08 AC 352 ms
110,164 KB
testcase_09 AC 356 ms
112,328 KB
testcase_10 AC 289 ms
102,228 KB
testcase_11 AC 194 ms
89,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L = int(input())
from math import gcd
N = L//4
# (x,y,z)=(2MN,M**2-N**2,M**2+N**2)
# SUM=2M(M+N)
N = N//2
A = set()
for i in range(1, N+1):
    if i**2 > N:
        break
    else:
        for j in range(1, N//i+1):
            if i < j:
                m = i
                n = j-i
                if m > n > 0:
                    P = [2*m*n, m**2-n**2, m**2+n**2]
                    P.sort()
                    if gcd(P[0],gcd(P[1],P[2]))==1:
                        A.add(tuple(P))
print(len(A))
0