結果

問題 No.800 四平方定理
ユーザー neterukunneterukun
提出日時 2019-03-18 22:01:59
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 312 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 345,824 KB
最終ジャッジ日時 2023-09-26 10:51:46
合計ジャッジ時間 33,127 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
81,332 KB
testcase_01 AC 126 ms
86,944 KB
testcase_02 AC 122 ms
83,236 KB
testcase_03 AC 125 ms
85,740 KB
testcase_04 AC 118 ms
83,340 KB
testcase_05 AC 122 ms
84,860 KB
testcase_06 AC 128 ms
89,428 KB
testcase_07 AC 120 ms
86,056 KB
testcase_08 AC 129 ms
89,300 KB
testcase_09 AC 123 ms
86,868 KB
testcase_10 AC 992 ms
262,620 KB
testcase_11 AC 989 ms
258,228 KB
testcase_12 AC 1,038 ms
257,956 KB
testcase_13 AC 978 ms
257,036 KB
testcase_14 AC 1,045 ms
258,176 KB
testcase_15 AC 1,055 ms
258,172 KB
testcase_16 AC 1,082 ms
258,508 KB
testcase_17 AC 1,151 ms
258,544 KB
testcase_18 AC 1,120 ms
258,408 KB
testcase_19 AC 1,097 ms
258,380 KB
testcase_20 AC 93 ms
71,584 KB
testcase_21 AC 93 ms
71,384 KB
testcase_22 AC 1,163 ms
258,232 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 91 ms
71,660 KB
testcase_27 AC 93 ms
71,724 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,d = map(int,input().split())

half = defaultdict(int)
for i in range(1,n+1):
    for j in range(1,n+1):
        half[i*i+j*j] +=1

ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        num = d+i*i-j*j
        if half[num]:
            ans += half[num]
print(ans)
0