結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-03-17 23:37:18 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 385 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 81,980 KB |
実行使用メモリ | 147,220 KB |
最終ジャッジ日時 | 2024-07-08 05:55:59 |
合計ジャッジ時間 | 4,925 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 RE * 8 |
ソースコード
from collections import defaultdict N, D = map(int, input().split()) r1 = [0] * 5000000 r2 = [0] * 5000000 ans = 0 for x in range(1, N + 1): for y in range(1, N + 1): r1[x**2 + y**2] += 1 for z in range(1, N + 1): for w in range(1, N + 1): if w**2 - z**2 + D > 1: r2[w**2 - z**2 + D] += 1 for i in range(5000000): ans += r1[i] * r2[i] print(ans)