結果

問題 No.800 四平方定理
ユーザー 910_sendai910_sendai
提出日時 2019-03-18 12:42:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 293 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 10,616 KB
実行使用メモリ 75,152 KB
最終ジャッジ日時 2023-09-25 07:57:00
合計ジャッジ時間 20,686 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
70,476 KB
testcase_01 AC 127 ms
70,452 KB
testcase_02 AC 119 ms
70,324 KB
testcase_03 AC 123 ms
70,468 KB
testcase_04 AC 118 ms
70,432 KB
testcase_05 AC 121 ms
70,412 KB
testcase_06 AC 135 ms
70,412 KB
testcase_07 AC 127 ms
70,392 KB
testcase_08 AC 137 ms
70,432 KB
testcase_09 AC 130 ms
70,372 KB
testcase_10 AC 1,190 ms
70,452 KB
testcase_11 AC 1,278 ms
70,516 KB
testcase_12 AC 1,324 ms
70,576 KB
testcase_13 AC 1,144 ms
70,584 KB
testcase_14 AC 1,236 ms
70,568 KB
testcase_15 AC 1,302 ms
70,364 KB
testcase_16 AC 1,266 ms
70,364 KB
testcase_17 AC 1,238 ms
70,412 KB
testcase_18 AC 1,338 ms
70,716 KB
testcase_19 AC 1,360 ms
70,688 KB
testcase_20 AC 98 ms
70,432 KB
testcase_21 AC 99 ms
70,488 KB
testcase_22 AC 1,397 ms
70,608 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 96 ms
70,368 KB
testcase_27 AC 97 ms
70,576 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())
ans = 0
p = []
cnt =[0] * (8 * 10**6 + 1)
## x*x + y*y = s 
for i in range(1, N+1):
    p.append(i*i)

for z in p:
    for w in p:
        s = w - z + D
        if s >= 0:
            cnt[s] += 1

for x in p:
    for y in p:
        ans += cnt[x+y]

print(ans)
0