結果

問題 No.800 四平方定理
ユーザー hanamihanami
提出日時 2019-04-09 19:57:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 291 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 51,068 KB
最終ジャッジ日時 2023-09-18 01:51:48
合計ジャッジ時間 24,531 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
13,060 KB
testcase_01 AC 62 ms
9,132 KB
testcase_02 AC 49 ms
8,740 KB
testcase_03 AC 53 ms
9,004 KB
testcase_04 AC 47 ms
8,780 KB
testcase_05 AC 53 ms
9,016 KB
testcase_06 AC 74 ms
9,396 KB
testcase_07 AC 61 ms
9,816 KB
testcase_08 AC 80 ms
11,396 KB
testcase_09 AC 64 ms
9,300 KB
testcase_10 AC 1,563 ms
42,576 KB
testcase_11 AC 1,795 ms
44,532 KB
testcase_12 AC 1,776 ms
46,776 KB
testcase_13 AC 1,565 ms
40,584 KB
testcase_14 AC 1,667 ms
42,720 KB
testcase_15 AC 1,812 ms
46,584 KB
testcase_16 AC 1,687 ms
43,160 KB
testcase_17 AC 1,742 ms
43,000 KB
testcase_18 AC 1,848 ms
50,864 KB
testcase_19 AC 1,869 ms
50,896 KB
testcase_20 AC 15 ms
7,796 KB
testcase_21 AC 16 ms
7,816 KB
testcase_22 AC 1,807 ms
51,068 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D=map(int,input().split())
zw_list=[0]*(2*N**2+D+1)
ans=0
for z in range(1,N+1):
    for w in range(1,N+1):
        cal=D-z**2+w**2
        if cal>0:
            zw_list[cal]+=1            
for x in range(1,N+1):
    for y in range(1,N+1):
        ans+=zw_list[x**2+y**2]
print(ans)       
0