結果

問題 No.800 四平方定理
ユーザー komkompikomkompi
提出日時 2020-08-17 23:33:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,370 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 203,648 KB
最終ジャッジ日時 2024-04-19 19:19:19
合計ジャッジ時間 18,511 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
63,104 KB
testcase_01 AC 53 ms
66,048 KB
testcase_02 AC 52 ms
65,280 KB
testcase_03 AC 50 ms
65,408 KB
testcase_04 AC 51 ms
64,768 KB
testcase_05 AC 52 ms
65,152 KB
testcase_06 AC 61 ms
66,944 KB
testcase_07 AC 55 ms
65,920 KB
testcase_08 AC 57 ms
66,688 KB
testcase_09 AC 57 ms
66,432 KB
testcase_10 AC 487 ms
162,176 KB
testcase_11 AC 502 ms
162,304 KB
testcase_12 AC 543 ms
162,304 KB
testcase_13 AC 526 ms
162,432 KB
testcase_14 AC 525 ms
162,432 KB
testcase_15 AC 559 ms
162,304 KB
testcase_16 AC 594 ms
162,432 KB
testcase_17 AC 576 ms
162,432 KB
testcase_18 AC 531 ms
162,688 KB
testcase_19 AC 523 ms
162,432 KB
testcase_20 AC 35 ms
51,200 KB
testcase_21 AC 34 ms
51,584 KB
testcase_22 AC 552 ms
162,432 KB
testcase_23 AC 1,307 ms
203,392 KB
testcase_24 AC 1,363 ms
203,264 KB
testcase_25 AC 1,358 ms
203,008 KB
testcase_26 AC 38 ms
51,968 KB
testcase_27 AC 37 ms
51,200 KB
testcase_28 AC 1,266 ms
203,264 KB
testcase_29 AC 1,258 ms
203,136 KB
testcase_30 AC 1,357 ms
203,648 KB
testcase_31 AC 1,178 ms
203,136 KB
testcase_32 AC 1,370 ms
203,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N,D=map(int,input().split())

xy={}
for i in range(1,N+1):
    for j in range(1,N+1):
        temp=(i**2+j**2)
        if temp in xy:
            xy[temp]+=1
        else:
            xy[temp]=1

ans=0

for i in range(1,N+1):
    for j in range(1,N+1):
        temp=(i**2-j**2)
        if D-temp in xy:
            ans+=xy[D-temp]

print(ans)
0