結果

問題 No.800 四平方定理
ユーザー 👑 rin204rin204
提出日時 2022-07-02 19:38:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,579 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 184,880 KB
最終ジャッジ日時 2023-08-18 11:35:20
合計ジャッジ時間 22,800 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,880 KB
testcase_01 AC 83 ms
78,832 KB
testcase_02 AC 87 ms
77,896 KB
testcase_03 AC 81 ms
78,412 KB
testcase_04 AC 81 ms
77,828 KB
testcase_05 AC 84 ms
78,064 KB
testcase_06 AC 87 ms
79,700 KB
testcase_07 AC 85 ms
78,836 KB
testcase_08 AC 88 ms
79,816 KB
testcase_09 AC 87 ms
79,376 KB
testcase_10 AC 661 ms
141,312 KB
testcase_11 AC 714 ms
148,056 KB
testcase_12 AC 696 ms
148,248 KB
testcase_13 AC 709 ms
144,092 KB
testcase_14 AC 757 ms
148,392 KB
testcase_15 AC 723 ms
148,328 KB
testcase_16 AC 760 ms
148,248 KB
testcase_17 AC 757 ms
148,368 KB
testcase_18 AC 702 ms
148,288 KB
testcase_19 AC 702 ms
147,956 KB
testcase_20 AC 64 ms
71,332 KB
testcase_21 AC 65 ms
71,320 KB
testcase_22 AC 747 ms
148,140 KB
testcase_23 AC 1,518 ms
184,880 KB
testcase_24 AC 1,495 ms
184,484 KB
testcase_25 AC 1,579 ms
184,500 KB
testcase_26 AC 66 ms
71,028 KB
testcase_27 AC 66 ms
71,324 KB
testcase_28 AC 1,406 ms
184,612 KB
testcase_29 AC 1,389 ms
184,220 KB
testcase_30 AC 1,480 ms
184,572 KB
testcase_31 AC 1,302 ms
173,064 KB
testcase_32 AC 1,565 ms
184,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
A = {}
for x in range(1, n + 1):
    for y in range(1, n + 1):
        m = x * x + y * y
        A[m] = A.get(m, 0) + 1

ans = 0
for z in range(1, n + 1):
    for w in range(1, n + 1):
        m = w * w + d - z * z
        ans += A.get(m, 0)
print(ans)
0