結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
Ueki
|
| 提出日時 | 2019-03-17 23:30:29 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 202 ms / 2,000 ms |
| + 490µs | |
| コード長 | 424 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 96,360 KB |
| 実行使用メモリ | 161,792 KB |
| 最終ジャッジ日時 | 2026-08-12 05:11:50 |
| 合計ジャッジ時間 | 6,369 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, D = map(int, input().split())
def solve2():
p = [x**2 for x in range(1, N+1)]
cnt = [0]*10**7
for w in p:
for z in p:
tmp = w-z+D
if tmp > 0:
cnt[tmp] += 1
ans = 0
for x in p:
for y in p:
ans += cnt[x+y]
print(ans)
solve2()
Ueki