結果

問題 No.800 四平方定理
ユーザー mlihua09mlihua09
提出日時 2020-08-29 19:40:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 343 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 337,088 KB
最終ジャッジ日時 2024-04-27 01:16:30
合計ジャッジ時間 25,742 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
84,444 KB
testcase_01 AC 93 ms
85,908 KB
testcase_02 AC 80 ms
79,212 KB
testcase_03 AC 86 ms
83,244 KB
testcase_04 AC 85 ms
78,668 KB
testcase_05 AC 85 ms
82,352 KB
testcase_06 AC 100 ms
91,036 KB
testcase_07 AC 87 ms
84,076 KB
testcase_08 AC 98 ms
91,024 KB
testcase_09 AC 93 ms
86,920 KB
testcase_10 AC 1,662 ms
322,556 KB
testcase_11 AC 1,841 ms
324,536 KB
testcase_12 AC 1,863 ms
324,348 KB
testcase_13 AC 1,771 ms
328,804 KB
testcase_14 AC 1,879 ms
325,276 KB
testcase_15 AC 1,902 ms
324,388 KB
testcase_16 AC 1,860 ms
325,536 KB
testcase_17 AC 1,906 ms
325,212 KB
testcase_18 AC 1,891 ms
324,840 KB
testcase_19 AC 1,868 ms
325,024 KB
testcase_20 AC 45 ms
54,492 KB
testcase_21 AC 41 ms
54,320 KB
testcase_22 AC 1,931 ms
324,908 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #


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

from collections import defaultdict

X = defaultdict(int)
Y = defaultdict(int)
ans = 0

for i in range(1, N + 1):
    
    for j in range(1, N + 1):
        
        X[i ** 2 + j ** 2] += 1
        
        Y[i ** 2 - j ** 2 + D] += 1
        
for k, v in Y.items():
    
    ans += v * X[k]
    
print(ans)
0