結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
neterukun
|
| 提出日時 | 2019-06-10 07:22:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 495 bytes |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 100,948 KB |
| 最終ジャッジ日時 | 2024-10-06 00:30:01 |
| 合計ジャッジ時間 | 27,631 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 12 TLE * 9 -- * 9 |
ソースコード
n, d = map(int, input().split())
li1 = {}
for x in range(1, n + 1):
for y in range(x + 1, n + 1):
if x**2 + y**2 not in li1:
li1[x**2 + y**2] = 2
else:
li1[x**2 + y**2] += 2
for x in range(1, n + 1):
if x**2 + x**2 not in li1:
li1[x**2 + x**2] = 1
else:
li1[x**2 + x**2] += 1
ans = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
if d + i**2 - j**2 in li1:
ans += li1[d + i**2 - j**2]
print(ans)
neterukun