結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-13 21:20:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 299 bytes |
| コンパイル時間 | 421 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 308,812 KB |
| 最終ジャッジ日時 | 2024-09-21 21:14:35 |
| 合計ジャッジ時間 | 20,845 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 TLE * 8 |
ソースコード
from collections import defaultdict
N, D = map(int, input().split())
V = defaultdict(int)
for y in range(1, N + 1):
for z in range(1, N + 1):
V[y**2 + z**2] += 1
ans = 0
for w in range(1, N + 1):
for x in range(1, N + 1):
E = w**2 + D - x**2
ans += V[E]
print(ans)