結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
wgrape
|
| 提出日時 | 2023-10-31 14:08:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 420 bytes |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 189,776 KB |
| 最終ジャッジ日時 | 2024-09-25 17:39:20 |
| 合計ジャッジ時間 | 5,931 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 RE * 1 |
ソースコード
N,D = map(int,input().split())
from collections import defaultdict
# x^2 + y^2で作れる数を全列挙
XY = [0] * ((N ** 2) * 4 + 1)
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):
target = D - (z ** 2 - w ** 2)
if target < 0:
continue
ans += XY[target]
print(ans)
wgrape