結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
wgrape
|
| 提出日時 | 2023-10-31 13:57:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 349 bytes |
| コンパイル時間 | 418 ms |
| コンパイル使用メモリ | 82,496 KB |
| 実行使用メモリ | 310,540 KB |
| 最終ジャッジ日時 | 2024-09-25 17:38:43 |
| 合計ジャッジ時間 | 21,679 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 TLE * 8 |
ソースコード
N,D = map(int,input().split())
from collections import defaultdict
# x^2 + y^2で作れる数を全列挙
XY = defaultdict(int)
for x in range(1, N + 1):
for y in range(1, N + 1):
XY[x**2 + y ** 2] += 1
ans = 0
for z in range(1, N + 1):
for w in range(1, N + 1):
ans += XY[D - (z ** 2 - w ** 2)]
print(ans)
wgrape