結果

問題 No.800 四平方定理
ユーザー 910_sendai910_sendai
提出日時 2019-03-18 12:48:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,301 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 70,724 KB
最終ジャッジ日時 2023-09-25 08:08:02
合計ジャッジ時間 20,039 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
70,364 KB
testcase_01 AC 65 ms
70,424 KB
testcase_02 AC 60 ms
70,444 KB
testcase_03 AC 63 ms
70,396 KB
testcase_04 AC 61 ms
70,500 KB
testcase_05 AC 61 ms
70,396 KB
testcase_06 AC 66 ms
70,444 KB
testcase_07 AC 64 ms
70,416 KB
testcase_08 AC 69 ms
70,488 KB
testcase_09 AC 65 ms
70,364 KB
testcase_10 AC 634 ms
70,488 KB
testcase_11 AC 685 ms
70,500 KB
testcase_12 AC 702 ms
70,464 KB
testcase_13 AC 602 ms
70,676 KB
testcase_14 AC 648 ms
70,724 KB
testcase_15 AC 700 ms
70,360 KB
testcase_16 AC 657 ms
70,528 KB
testcase_17 AC 668 ms
70,548 KB
testcase_18 AC 744 ms
70,608 KB
testcase_19 AC 753 ms
70,560 KB
testcase_20 AC 52 ms
70,484 KB
testcase_21 AC 52 ms
70,436 KB
testcase_22 AC 742 ms
70,580 KB
testcase_23 AC 1,301 ms
70,696 KB
testcase_24 AC 1,164 ms
70,588 KB
testcase_25 AC 1,280 ms
70,580 KB
testcase_26 AC 52 ms
70,488 KB
testcase_27 AC 53 ms
70,412 KB
testcase_28 AC 1,173 ms
70,360 KB
testcase_29 AC 1,249 ms
70,544 KB
testcase_30 AC 1,181 ms
70,460 KB
testcase_31 AC 1,071 ms
70,548 KB
testcase_32 AC 1,178 ms
70,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    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)
solve()
0