結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
43,116 KB
testcase_01 AC 106 ms
43,216 KB
testcase_02 AC 91 ms
43,140 KB
testcase_03 AC 96 ms
43,048 KB
testcase_04 AC 91 ms
43,148 KB
testcase_05 AC 94 ms
43,116 KB
testcase_06 AC 113 ms
43,048 KB
testcase_07 AC 104 ms
42,984 KB
testcase_08 AC 114 ms
43,180 KB
testcase_09 AC 108 ms
43,132 KB
testcase_10 AC 1,507 ms
43,080 KB
testcase_11 AC 1,624 ms
43,152 KB
testcase_12 AC 1,721 ms
43,168 KB
testcase_13 AC 1,537 ms
43,144 KB
testcase_14 AC 1,664 ms
43,156 KB
testcase_15 AC 1,739 ms
43,088 KB
testcase_16 AC 1,712 ms
43,044 KB
testcase_17 AC 1,717 ms
43,164 KB
testcase_18 AC 1,773 ms
43,148 KB
testcase_19 AC 1,861 ms
43,052 KB
testcase_20 AC 62 ms
43,164 KB
testcase_21 AC 62 ms
43,084 KB
testcase_22 AC 1,760 ms
43,084 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 62 ms
43,136 KB
testcase_27 AC 62 ms
43,216 KB
testcase_28 RE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 RE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

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=i*i-j*j+d
        if s>=0:
            cnt[s]+=1
ans=0
for i in range(1,n+1):
    for j in range(1,n+1):
        ans+=cnt[i*i+j*j]
print(ans)
0