結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-29 10:17:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 343 bytes |
| コンパイル時間 | 419 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 406,096 KB |
| 最終ジャッジ日時 | 2024-07-22 04:50:47 |
| 合計ジャッジ時間 | 26,639 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 TLE * 8 |
ソースコード
from collections import Counter
N, D = map(int, input().split())
xpy = []
for x in range(1, N + 1):
for y in range(1, N + 1):
xpy.append(x**2 + y**2)
wmz = []
for w in range(1, N + 1):
for z in range(1, N + 1):
wmz.append(w**2 - z**2)
cnt = Counter(wmz)
ans = 0
for xy in xpy:
ans += cnt.get(xy - D, 0)
print(ans)