結果

問題 No.800 四平方定理
ユーザー rin204rin204
提出日時 2022-07-02 19:38:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,602 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 182,932 KB
最終ジャッジ日時 2024-05-05 16:55:15
合計ジャッジ時間 21,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
63,488 KB
testcase_01 AC 57 ms
66,176 KB
testcase_02 AC 55 ms
65,280 KB
testcase_03 AC 55 ms
65,408 KB
testcase_04 AC 53 ms
64,768 KB
testcase_05 AC 54 ms
65,280 KB
testcase_06 AC 58 ms
67,328 KB
testcase_07 AC 56 ms
65,664 KB
testcase_08 AC 62 ms
66,816 KB
testcase_09 AC 59 ms
66,816 KB
testcase_10 AC 587 ms
147,584 KB
testcase_11 AC 693 ms
147,712 KB
testcase_12 AC 684 ms
147,456 KB
testcase_13 AC 668 ms
147,584 KB
testcase_14 AC 725 ms
148,096 KB
testcase_15 AC 726 ms
147,968 KB
testcase_16 AC 751 ms
147,968 KB
testcase_17 AC 740 ms
147,712 KB
testcase_18 AC 692 ms
147,840 KB
testcase_19 AC 706 ms
147,840 KB
testcase_20 AC 35 ms
51,584 KB
testcase_21 AC 36 ms
51,840 KB
testcase_22 AC 735 ms
147,968 KB
testcase_23 AC 1,574 ms
182,680 KB
testcase_24 AC 1,581 ms
182,852 KB
testcase_25 AC 1,598 ms
182,556 KB
testcase_26 AC 35 ms
51,712 KB
testcase_27 AC 36 ms
51,584 KB
testcase_28 AC 1,493 ms
182,544 KB
testcase_29 AC 1,468 ms
182,672 KB
testcase_30 AC 1,531 ms
182,932 KB
testcase_31 AC 1,334 ms
177,356 KB
testcase_32 AC 1,602 ms
182,812 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