結果

問題 No.800 四平方定理
コンテスト
ユーザー lloyz
提出日時 2022-11-03 13:26:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 434 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 293 ms
コンパイル使用メモリ 85,580 KB
実行使用メモリ 592,468 KB
最終ジャッジ日時 2026-04-01 14:23:31
合計ジャッジ時間 13,071 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, d = map(int, input().split())

counter = dict()
for w in range(1, n + 1):
    for z in range(1, n + 1):
        res = w**2 - z**2
        if counter.get(res, None) is None:
            counter[res] = 1
        else:
            counter[res] += 1

ans = 0
for x in range(1, n + 1):
    for y in range(1, n + 1):
        res = x**2 + y**2 - d
        if counter.get(res, None) is not None:
            ans += counter[res]
print(ans)
0