結果

問題 No.800 四平方定理
ユーザー kozykozy
提出日時 2020-08-27 17:33:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,490 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 972 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 272,520 KB
最終ジャッジ日時 2024-04-25 10:40:51
合計ジャッジ時間 22,442 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
128,960 KB
testcase_01 AC 124 ms
132,804 KB
testcase_02 AC 127 ms
130,944 KB
testcase_03 AC 127 ms
131,456 KB
testcase_04 AC 122 ms
130,304 KB
testcase_05 AC 127 ms
131,064 KB
testcase_06 AC 129 ms
134,784 KB
testcase_07 AC 121 ms
131,200 KB
testcase_08 AC 124 ms
133,504 KB
testcase_09 AC 128 ms
132,736 KB
testcase_10 AC 639 ms
264,704 KB
testcase_11 AC 712 ms
264,040 KB
testcase_12 AC 702 ms
264,192 KB
testcase_13 AC 637 ms
264,200 KB
testcase_14 AC 716 ms
263,832 KB
testcase_15 AC 710 ms
264,080 KB
testcase_16 AC 717 ms
263,808 KB
testcase_17 AC 703 ms
264,032 KB
testcase_18 AC 759 ms
263,716 KB
testcase_19 AC 748 ms
263,936 KB
testcase_20 AC 95 ms
119,424 KB
testcase_21 AC 95 ms
119,552 KB
testcase_22 AC 744 ms
264,048 KB
testcase_23 AC 1,490 ms
272,492 KB
testcase_24 AC 1,467 ms
272,236 KB
testcase_25 AC 1,480 ms
272,256 KB
testcase_26 AC 98 ms
119,936 KB
testcase_27 AC 104 ms
119,176 KB
testcase_28 AC 1,446 ms
272,292 KB
testcase_29 AC 1,436 ms
272,244 KB
testcase_30 AC 1,449 ms
272,520 KB
testcase_31 AC 1,305 ms
258,748 KB
testcase_32 AC 1,459 ms
272,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D=map(int,input().split())
c=[0 for i in range(2*(4000000)+1)]
for i in range(1,1+N):
    for j in range(1,1+N):
        a=i**2+j**2
        c[a]+=1
m=dict()
for i in range(1,1+N):
    for j in range(1,1+N):
        a=i**2-j**2
        if a in m:
            m[a]+=1
        else:
            m[a]=1
ans=0
for i in m:
    k=D-i
    if k>=0:
      ans+=m[i]*c[k]
print(ans)
0