結果

問題 No.800 四平方定理
ユーザー UekiUeki
提出日時 2019-03-17 23:30:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 264 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 154,688 KB
最終ジャッジ日時 2023-09-22 11:41:35
合計ジャッジ時間 7,137 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
153,552 KB
testcase_01 AC 103 ms
153,596 KB
testcase_02 AC 104 ms
153,588 KB
testcase_03 AC 105 ms
153,488 KB
testcase_04 AC 101 ms
153,760 KB
testcase_05 AC 102 ms
153,628 KB
testcase_06 AC 101 ms
153,584 KB
testcase_07 AC 103 ms
153,728 KB
testcase_08 AC 100 ms
153,576 KB
testcase_09 AC 102 ms
153,748 KB
testcase_10 AC 184 ms
154,488 KB
testcase_11 AC 172 ms
154,688 KB
testcase_12 AC 178 ms
154,524 KB
testcase_13 AC 161 ms
154,248 KB
testcase_14 AC 159 ms
154,560 KB
testcase_15 AC 176 ms
154,420 KB
testcase_16 AC 162 ms
154,392 KB
testcase_17 AC 164 ms
154,560 KB
testcase_18 AC 195 ms
154,524 KB
testcase_19 AC 192 ms
154,476 KB
testcase_20 AC 94 ms
149,144 KB
testcase_21 AC 95 ms
149,600 KB
testcase_22 AC 198 ms
154,596 KB
testcase_23 AC 263 ms
154,628 KB
testcase_24 AC 220 ms
154,592 KB
testcase_25 AC 264 ms
154,460 KB
testcase_26 AC 95 ms
149,372 KB
testcase_27 AC 94 ms
149,396 KB
testcase_28 AC 221 ms
154,644 KB
testcase_29 AC 250 ms
154,564 KB
testcase_30 AC 223 ms
154,424 KB
testcase_31 AC 214 ms
154,492 KB
testcase_32 AC 239 ms
154,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, D = map(int, input().split())


def solve2():
    p = [x**2 for x in range(1, N+1)]
    cnt = [0]*10**7

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

    ans = 0
    for x in p:
        for y in p:
            ans += cnt[x+y]
    print(ans)


solve2()
0