結果

問題 No.800 四平方定理
ユーザー neterukunneterukun
提出日時 2019-05-17 20:33:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,586 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 1,588 ms
コンパイル使用メモリ 81,372 KB
実行使用メモリ 202,712 KB
最終ジャッジ日時 2023-10-17 07:26:22
合計ジャッジ時間 21,488 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
64,908 KB
testcase_01 AC 58 ms
66,632 KB
testcase_02 AC 57 ms
68,004 KB
testcase_03 AC 57 ms
66,296 KB
testcase_04 AC 57 ms
65,640 KB
testcase_05 AC 56 ms
65,948 KB
testcase_06 AC 63 ms
69,668 KB
testcase_07 AC 57 ms
66,688 KB
testcase_08 AC 58 ms
67,620 KB
testcase_09 AC 62 ms
69,180 KB
testcase_10 AC 624 ms
153,316 KB
testcase_11 AC 666 ms
161,824 KB
testcase_12 AC 684 ms
161,824 KB
testcase_13 AC 701 ms
161,824 KB
testcase_14 AC 660 ms
161,824 KB
testcase_15 AC 716 ms
161,824 KB
testcase_16 AC 719 ms
161,824 KB
testcase_17 AC 705 ms
161,824 KB
testcase_18 AC 701 ms
161,824 KB
testcase_19 AC 718 ms
161,824 KB
testcase_20 AC 38 ms
53,348 KB
testcase_21 AC 38 ms
53,348 KB
testcase_22 AC 743 ms
161,824 KB
testcase_23 AC 1,523 ms
202,712 KB
testcase_24 AC 1,426 ms
202,712 KB
testcase_25 AC 1,586 ms
202,712 KB
testcase_26 AC 38 ms
53,348 KB
testcase_27 AC 39 ms
53,348 KB
testcase_28 AC 1,369 ms
202,712 KB
testcase_29 AC 1,429 ms
202,712 KB
testcase_30 AC 1,532 ms
202,712 KB
testcase_31 AC 1,350 ms
202,448 KB
testcase_32 AC 1,546 ms
202,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

li1 = {}
for x in range(1, n + 1):
    for y in range(1, n + 1):
        if x**2 + y**2 not in li1:
            li1[x**2 + y**2] = 1
        else:
            li1[x**2 + y**2] += 1
ans = 0
for i in range(1, n + 1):
    for j in range(1, n + 1):
        if d + i**2 - j**2 in li1:
            ans += li1[d + i**2 - j**2]
print(ans)
0