結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-13 21:20:11 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 299 bytes |
| 記録 | |
| コンパイル時間 | 315 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 187,560 KB |
| 最終ジャッジ日時 | 2026-04-10 02:50:43 |
| 合計ジャッジ時間 | 30,497 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 10 TLE * 11 -- * 9 |
ソースコード
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)