結果

問題 No.152 貯金箱の消失
ユーザー kurimupykurimupy
提出日時 2020-06-21 02:38:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,776 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 45,248 KB
最終ジャッジ日時 2023-09-16 18:02:05
合計ジャッジ時間 10,505 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,076 KB
testcase_01 AC 17 ms
8,084 KB
testcase_02 AC 16 ms
8,180 KB
testcase_03 AC 16 ms
8,228 KB
testcase_04 AC 41 ms
8,684 KB
testcase_05 AC 47 ms
8,856 KB
testcase_06 AC 70 ms
9,100 KB
testcase_07 AC 435 ms
14,440 KB
testcase_08 AC 2,774 ms
45,248 KB
testcase_09 AC 2,776 ms
45,052 KB
testcase_10 AC 2,188 ms
33,676 KB
testcase_11 AC 1,215 ms
22,472 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