結果
| 問題 | No.2979 直角三角形の個数 |
| コンテスト | |
| ユーザー |
むつある
|
| 提出日時 | 2024-12-03 23:25:51 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 296 bytes |
| 記録 | |
| コンパイル時間 | 298 ms |
| コンパイル使用メモリ | 85,192 KB |
| 実行使用メモリ | 66,552 KB |
| 最終ジャッジ日時 | 2026-05-24 16:04:00 |
| 合計ジャッジ時間 | 13,051 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 16 TLE * 2 -- * 8 |
ソースコード
import math
n=int(input())
ans=0
for i in range(1,int(n**.5)+1):
for j in range(1,i):
if i**2+i*j>n:
break
if i**2-j**2<=2*i*j:
break
if math.gcd(i,j)!=1:
continue
if j&1 and i&1:
ans+=n//(i**2+i*j)
else:
ans+=n//(2*(i**2+i*j))
print(ans)
むつある