結果

問題 No.800 四平方定理
ユーザー ayaoniayaoni
提出日時 2020-11-27 03:23:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,396 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 948 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 260,512 KB
最終ジャッジ日時 2023-10-01 03:53:04
合計ジャッジ時間 19,743 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
79,612 KB
testcase_01 AC 120 ms
82,936 KB
testcase_02 AC 117 ms
80,824 KB
testcase_03 AC 120 ms
81,676 KB
testcase_04 AC 116 ms
81,084 KB
testcase_05 AC 116 ms
81,600 KB
testcase_06 AC 121 ms
84,940 KB
testcase_07 AC 120 ms
85,800 KB
testcase_08 AC 128 ms
89,216 KB
testcase_09 AC 124 ms
83,028 KB
testcase_10 AC 607 ms
198,464 KB
testcase_11 AC 614 ms
198,788 KB
testcase_12 AC 676 ms
219,992 KB
testcase_13 AC 543 ms
188,516 KB
testcase_14 AC 601 ms
198,484 KB
testcase_15 AC 668 ms
219,960 KB
testcase_16 AC 604 ms
198,808 KB
testcase_17 AC 602 ms
198,328 KB
testcase_18 AC 747 ms
259,808 KB
testcase_19 AC 727 ms
260,512 KB
testcase_20 AC 93 ms
71,796 KB
testcase_21 AC 93 ms
71,876 KB
testcase_22 AC 720 ms
219,908 KB
testcase_23 AC 1,325 ms
257,492 KB
testcase_24 AC 1,093 ms
258,184 KB
testcase_25 AC 1,396 ms
258,168 KB
testcase_26 AC 92 ms
71,396 KB
testcase_27 AC 90 ms
71,568 KB
testcase_28 AC 1,065 ms
257,864 KB
testcase_29 AC 1,137 ms
258,320 KB
testcase_30 AC 1,060 ms
251,752 KB
testcase_31 AC 982 ms
259,644 KB
testcase_32 AC 1,122 ms
251,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,D = MI()

count = defaultdict(int)
for i in range(1,N+1):
    for j in range(i,N+1):
        a = i**2+j**2
        if i == j:
            count[a] += 1
        else:
            count[a] += 2

ans = 0
for i in range(1,N+1):
    for j in range(1,N+1):
        b = -i**2+j**2+D
        if b >= 2:
            ans += count[-i**2+j**2+D]

print(ans)
0