結果

問題 No.800 四平方定理
ユーザー kozykozy
提出日時 2020-08-27 17:31:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 371 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 273,008 KB
最終ジャッジ日時 2024-04-25 10:38:59
合計ジャッジ時間 21,198 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
67,200 KB
testcase_01 AC 63 ms
71,424 KB
testcase_02 AC 61 ms
68,992 KB
testcase_03 AC 61 ms
69,504 KB
testcase_04 AC 60 ms
68,224 KB
testcase_05 AC 59 ms
69,760 KB
testcase_06 AC 64 ms
73,600 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 61 ms
71,296 KB
testcase_10 AC 595 ms
233,088 KB
testcase_11 AC 665 ms
250,496 KB
testcase_12 AC 649 ms
249,984 KB
testcase_13 AC 596 ms
248,064 KB
testcase_14 AC 638 ms
250,624 KB
testcase_15 AC 684 ms
250,496 KB
testcase_16 AC 703 ms
250,752 KB
testcase_17 AC 677 ms
251,008 KB
testcase_18 AC 694 ms
250,496 KB
testcase_19 AC 697 ms
251,008 KB
testcase_20 AC 35 ms
51,712 KB
testcase_21 RE -
testcase_22 AC 717 ms
250,624 KB
testcase_23 AC 1,465 ms
272,756 KB
testcase_24 AC 1,410 ms
272,624 KB
testcase_25 AC 1,471 ms
272,588 KB
testcase_26 AC 35 ms
52,224 KB
testcase_27 RE -
testcase_28 AC 1,433 ms
272,208 KB
testcase_29 AC 1,442 ms
272,632 KB
testcase_30 AC 1,399 ms
272,260 KB
testcase_31 AC 1,263 ms
255,696 KB
testcase_32 AC 1,459 ms
273,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D=map(int,input().split())
c=[0 for i in range(2*(N**2)+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