結果

問題 No.800 四平方定理
ユーザー tpynerivertpyneriver
提出日時 2019-03-18 02:08:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 140,284 KB
最終ジャッジ日時 2023-09-22 16:29:05
合計ジャッジ時間 8,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
139,496 KB
testcase_01 AC 127 ms
139,944 KB
testcase_02 AC 127 ms
139,860 KB
testcase_03 AC 123 ms
139,876 KB
testcase_04 AC 124 ms
140,060 KB
testcase_05 AC 126 ms
139,816 KB
testcase_06 AC 127 ms
139,936 KB
testcase_07 AC 125 ms
139,844 KB
testcase_08 AC 125 ms
139,700 KB
testcase_09 AC 125 ms
139,700 KB
testcase_10 AC 198 ms
140,180 KB
testcase_11 AC 213 ms
140,028 KB
testcase_12 AC 212 ms
140,152 KB
testcase_13 AC 209 ms
140,196 KB
testcase_14 AC 222 ms
140,204 KB
testcase_15 AC 212 ms
140,284 KB
testcase_16 AC 223 ms
140,056 KB
testcase_17 AC 224 ms
140,264 KB
testcase_18 AC 210 ms
140,000 KB
testcase_19 AC 205 ms
140,252 KB
testcase_20 AC 110 ms
133,952 KB
testcase_21 AC 111 ms
134,164 KB
testcase_22 AC 205 ms
140,232 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 114 ms
134,284 KB
testcase_27 AC 113 ms
133,952 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from collections import defaultdict 
cnt = [0] * (8*10**6 + 1)


lst = [ i**2 for i in range(1, N+1)]

for i in range(N):
    for j in range(N):
        # if i == j:
        cnt[ lst[i] + lst[j] ] += 1
        # else:
        #     cnt[ lst[i] + lst[j] ] += 2

ans = 0

for i in range(N):
    for j in range(N):
        x,y = lst[i], lst[j]
        # if i == j : 
        ans += cnt[ y+D - x ]

print(ans)
            
0