結果

問題 No.800 四平方定理
ユーザー 👑 H20H20
提出日時 2020-11-19 10:03:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 1,623 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 139,276 KB
最終ジャッジ日時 2023-09-30 16:03:17
合計ジャッジ時間 8,318 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
138,640 KB
testcase_01 AC 100 ms
138,992 KB
testcase_02 AC 100 ms
138,960 KB
testcase_03 AC 101 ms
138,872 KB
testcase_04 AC 99 ms
138,624 KB
testcase_05 AC 99 ms
138,580 KB
testcase_06 AC 100 ms
138,848 KB
testcase_07 AC 101 ms
138,796 KB
testcase_08 AC 100 ms
138,596 KB
testcase_09 AC 98 ms
138,700 KB
testcase_10 AC 169 ms
139,000 KB
testcase_11 AC 172 ms
138,896 KB
testcase_12 AC 180 ms
139,000 KB
testcase_13 AC 158 ms
139,204 KB
testcase_14 AC 171 ms
138,872 KB
testcase_15 AC 180 ms
138,900 KB
testcase_16 AC 170 ms
138,876 KB
testcase_17 AC 168 ms
138,904 KB
testcase_18 AC 192 ms
139,164 KB
testcase_19 AC 190 ms
139,052 KB
testcase_20 AC 89 ms
133,800 KB
testcase_21 AC 91 ms
134,044 KB
testcase_22 AC 189 ms
139,008 KB
testcase_23 AC 287 ms
139,004 KB
testcase_24 AC 258 ms
139,016 KB
testcase_25 AC 286 ms
139,052 KB
testcase_26 AC 90 ms
133,960 KB
testcase_27 AC 92 ms
133,704 KB
testcase_28 AC 252 ms
139,276 KB
testcase_29 AC 276 ms
139,032 KB
testcase_30 AC 249 ms
139,108 KB
testcase_31 AC 236 ms
139,156 KB
testcase_32 AC 264 ms
138,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D=map(int, input().split())
Square = []
P = [0]*(2000**2*2+5)

for i in range(N+1):
    Square.append(i**2)
for i in range(1,N+1):
    for j in range(1,N+1):
        P[Square[i]+Square[j]]+=1
ans = 0
for i in range(1,N+1):
    for j in range(1,N+1):
        temp = Square[i]-Square[j]+D
        if temp >=0:
            ans += P[temp]

print(ans)    
0