結果

問題 No.800 四平方定理
ユーザー mlihua09mlihua09
提出日時 2020-08-29 19:42:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 2,439 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 190,276 KB
最終ジャッジ日時 2024-04-27 01:16:55
合計ジャッジ時間 8,166 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
187,392 KB
testcase_01 AC 106 ms
188,140 KB
testcase_02 AC 107 ms
187,152 KB
testcase_03 AC 107 ms
187,492 KB
testcase_04 AC 109 ms
187,024 KB
testcase_05 AC 113 ms
187,596 KB
testcase_06 AC 108 ms
187,040 KB
testcase_07 AC 115 ms
188,292 KB
testcase_08 AC 107 ms
186,788 KB
testcase_09 AC 113 ms
187,420 KB
testcase_10 AC 179 ms
188,344 KB
testcase_11 AC 180 ms
188,444 KB
testcase_12 AC 191 ms
188,356 KB
testcase_13 AC 183 ms
188,080 KB
testcase_14 AC 185 ms
188,376 KB
testcase_15 AC 192 ms
188,340 KB
testcase_16 AC 186 ms
188,348 KB
testcase_17 AC 189 ms
188,720 KB
testcase_18 AC 215 ms
188,316 KB
testcase_19 AC 202 ms
189,768 KB
testcase_20 AC 124 ms
183,332 KB
testcase_21 AC 100 ms
183,548 KB
testcase_22 AC 207 ms
189,172 KB
testcase_23 AC 283 ms
190,276 KB
testcase_24 AC 258 ms
188,384 KB
testcase_25 AC 302 ms
188,264 KB
testcase_26 AC 106 ms
183,124 KB
testcase_27 AC 108 ms
182,932 KB
testcase_28 AC 252 ms
188,048 KB
testcase_29 AC 268 ms
188,492 KB
testcase_30 AC 266 ms
188,508 KB
testcase_31 AC 243 ms
188,276 KB
testcase_32 AC 252 ms
187,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


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

X = [0] * (8 * 10 ** 6 + 1)
Y = [0] * (8 * 10 ** 6 + 1)
ans = 0

for i in range(1, N + 1):
    
    for j in range(1, N + 1):
        
        X[i ** 2 + j ** 2] += 1
        if i ** 2 - j ** 2 + D > 0:
            Y[i ** 2 - j ** 2 + D] += 1
        
for i in range(8 * 10 ** 6 + 1):
    ans += X[i] * Y[i]
print(ans)
0