結果
問題 | No.152 貯金箱の消失 |
ユーザー |
![]() |
提出日時 | 2020-12-27 16:51:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 505 ms / 5,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-01 15:03:33 |
合計ジャッジ時間 | 2,865 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
from math import gcd as g def gcd(a, b, c): return g(a, g(b, c)) L = int(input()) if L < 48: print(0) exit() L //= 4 ans = 0 for m in range(1, int(L ** 0.5) + 10): for n in range(1, m): if 2 * m * (m + n) > L: break a = m*m - n*n b = 2*m*n c = m*m - n*n if gcd(a, b, c) == 1: ans += 1 print(ans)