結果

問題 No.800 四平方定理
ユーザー heno239heno239
提出日時 2019-03-14 14:55:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 293 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 10,580 KB
実行使用メモリ 43,368 KB
最終ジャッジ日時 2023-09-14 12:12:40
合計ジャッジ時間 25,921 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
42,960 KB
testcase_01 AC 95 ms
43,148 KB
testcase_02 AC 84 ms
43,200 KB
testcase_03 AC 89 ms
43,068 KB
testcase_04 AC 84 ms
43,076 KB
testcase_05 AC 88 ms
43,072 KB
testcase_06 AC 103 ms
43,136 KB
testcase_07 AC 96 ms
43,072 KB
testcase_08 AC 109 ms
43,188 KB
testcase_09 AC 97 ms
43,072 KB
testcase_10 AC 1,225 ms
43,024 KB
testcase_11 AC 1,299 ms
43,132 KB
testcase_12 AC 1,299 ms
43,196 KB
testcase_13 AC 1,213 ms
43,224 KB
testcase_14 AC 1,209 ms
43,140 KB
testcase_15 AC 1,267 ms
43,140 KB
testcase_16 AC 1,297 ms
43,136 KB
testcase_17 AC 1,257 ms
43,216 KB
testcase_18 AC 1,369 ms
43,032 KB
testcase_19 AC 1,417 ms
43,004 KB
testcase_20 AC 63 ms
43,072 KB
testcase_21 AC 62 ms
43,092 KB
testcase_22 AC 1,417 ms
43,072 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 62 ms
43,136 KB
testcase_27 AC 62 ms
43,132 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d=map(int,input().split())
cnt=[0]*4500001
for i in range(1,n+1):
    for j in range(1,n+1):
        s=j*j-i*i+d
        if s>=0:
            cnt[s]+=1
ans=0
for i in range(1,n+1):
    ans+=cnt[2*i*i]
for i in range(1,n+1):
    for j in range(i+1,n+1):
        ans+=2*cnt[i*i+j*j]
print(ans)
0