結果

問題 No.800 四平方定理
ユーザー hazohelhazohel
提出日時 2019-03-20 14:54:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 191,176 KB
最終ジャッジ日時 2023-10-19 04:24:35
合計ジャッジ時間 7,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
186,884 KB
testcase_01 AC 122 ms
187,060 KB
testcase_02 AC 122 ms
187,060 KB
testcase_03 AC 124 ms
187,060 KB
testcase_04 AC 122 ms
187,060 KB
testcase_05 AC 120 ms
187,060 KB
testcase_06 AC 121 ms
187,060 KB
testcase_07 AC 123 ms
187,060 KB
testcase_08 AC 122 ms
187,064 KB
testcase_09 AC 121 ms
187,060 KB
testcase_10 AC 196 ms
189,128 KB
testcase_11 AC 203 ms
189,128 KB
testcase_12 AC 205 ms
189,128 KB
testcase_13 AC 193 ms
189,128 KB
testcase_14 AC 206 ms
189,128 KB
testcase_15 AC 204 ms
189,128 KB
testcase_16 AC 204 ms
189,128 KB
testcase_17 AC 215 ms
189,128 KB
testcase_18 AC 213 ms
189,128 KB
testcase_19 AC 216 ms
189,128 KB
testcase_20 AC 111 ms
182,336 KB
testcase_21 AC 112 ms
184,384 KB
testcase_22 AC 215 ms
189,128 KB
testcase_23 AC 288 ms
191,176 KB
testcase_24 AC 290 ms
189,128 KB
testcase_25 AC 289 ms
191,176 KB
testcase_26 AC 114 ms
182,336 KB
testcase_27 AC 118 ms
182,336 KB
testcase_28 AC 271 ms
189,128 KB
testcase_29 AC 279 ms
191,176 KB
testcase_30 AC 273 ms
189,128 KB
testcase_31 AC 260 ms
189,128 KB
testcase_32 AC 275 ms
191,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 8000001
left = [0]*INF
right = [0]*INF
N, D = map(int, input().split())

for x in range(1, N+1):
    for y in range(1, N+1):
        left[x**2 + y**2] += 1
for z in range(1, N+1):
    for w in range(1, N+1):
        if w**2 - z**2 + D > 0:
            right[w**2 - z**2 + D] += 1
ans = 0;
for i in range(INF):
    ans += left[i] * right[i]
print(ans)
0