結果

問題 No.800 四平方定理
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-29 03:13:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,541 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 203,828 KB
最終ジャッジ日時 2023-08-30 18:34:01
合計ジャッジ時間 23,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
77,192 KB
testcase_01 AC 98 ms
78,924 KB
testcase_02 AC 91 ms
78,156 KB
testcase_03 AC 92 ms
78,652 KB
testcase_04 AC 87 ms
77,832 KB
testcase_05 AC 89 ms
78,092 KB
testcase_06 AC 92 ms
79,836 KB
testcase_07 AC 92 ms
78,900 KB
testcase_08 AC 96 ms
80,072 KB
testcase_09 AC 94 ms
79,520 KB
testcase_10 AC 673 ms
154,540 KB
testcase_11 AC 735 ms
163,028 KB
testcase_12 AC 727 ms
163,004 KB
testcase_13 AC 729 ms
154,612 KB
testcase_14 AC 753 ms
163,048 KB
testcase_15 AC 757 ms
163,104 KB
testcase_16 AC 783 ms
163,200 KB
testcase_17 AC 770 ms
163,116 KB
testcase_18 AC 728 ms
163,112 KB
testcase_19 AC 728 ms
163,152 KB
testcase_20 AC 73 ms
71,092 KB
testcase_21 AC 74 ms
71,348 KB
testcase_22 AC 756 ms
163,200 KB
testcase_23 AC 1,500 ms
203,828 KB
testcase_24 AC 1,523 ms
203,756 KB
testcase_25 AC 1,541 ms
203,704 KB
testcase_26 AC 75 ms
71,220 KB
testcase_27 AC 73 ms
71,172 KB
testcase_28 AC 1,452 ms
203,768 KB
testcase_29 AC 1,406 ms
203,712 KB
testcase_30 AC 1,512 ms
203,660 KB
testcase_31 AC 1,292 ms
195,380 KB
testcase_32 AC 1,535 ms
203,724 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