結果

問題 No.800 四平方定理
ユーザー brthyyjpbrthyyjp
提出日時 2020-05-07 08:35:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,576 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 86,644 KB
実行使用メモリ 203,824 KB
最終ジャッジ日時 2023-09-16 07:45:36
合計ジャッジ時間 22,800 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,908 KB
testcase_01 AC 91 ms
78,836 KB
testcase_02 AC 85 ms
78,172 KB
testcase_03 AC 89 ms
78,528 KB
testcase_04 AC 87 ms
77,804 KB
testcase_05 AC 86 ms
78,004 KB
testcase_06 AC 92 ms
79,776 KB
testcase_07 AC 90 ms
78,844 KB
testcase_08 AC 90 ms
79,688 KB
testcase_09 AC 91 ms
79,168 KB
testcase_10 AC 664 ms
154,508 KB
testcase_11 AC 678 ms
162,864 KB
testcase_12 AC 618 ms
162,876 KB
testcase_13 AC 636 ms
154,340 KB
testcase_14 AC 667 ms
162,900 KB
testcase_15 AC 671 ms
163,048 KB
testcase_16 AC 654 ms
163,132 KB
testcase_17 AC 722 ms
162,972 KB
testcase_18 AC 648 ms
163,032 KB
testcase_19 AC 676 ms
163,284 KB
testcase_20 AC 72 ms
70,960 KB
testcase_21 AC 73 ms
71,312 KB
testcase_22 AC 692 ms
163,000 KB
testcase_23 AC 1,555 ms
203,384 KB
testcase_24 AC 1,520 ms
203,624 KB
testcase_25 AC 1,576 ms
203,376 KB
testcase_26 AC 70 ms
71,120 KB
testcase_27 AC 70 ms
71,256 KB
testcase_28 AC 1,367 ms
203,824 KB
testcase_29 AC 1,435 ms
203,716 KB
testcase_30 AC 1,460 ms
203,524 KB
testcase_31 AC 1,294 ms
195,232 KB
testcase_32 AC 1,551 ms
203,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

d1 = {}
for x in range(1, n+1):
    for y in range(1, n+1):
        s = x**2+y**2
        if s in d1:
            d1[s] += 1
        else:
            d1[s] = 1
ans = 0
for z in range(1, n+1):
    for w in range(1, n+1):
        s = z**2-w**2
        if d-s in d1:
            ans += d1[d-s]
print(ans)
0