結果

問題 No.800 四平方定理
ユーザー neterukunneterukun
提出日時 2019-03-18 22:28:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,783 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 87,308 KB
実行使用メモリ 266,992 KB
最終ジャッジ日時 2023-09-26 12:25:14
合計ジャッジ時間 26,327 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
80,952 KB
testcase_01 AC 118 ms
86,416 KB
testcase_02 AC 114 ms
82,660 KB
testcase_03 AC 115 ms
85,692 KB
testcase_04 AC 113 ms
82,684 KB
testcase_05 AC 116 ms
84,992 KB
testcase_06 AC 122 ms
89,288 KB
testcase_07 AC 116 ms
85,764 KB
testcase_08 AC 123 ms
89,120 KB
testcase_09 AC 119 ms
86,420 KB
testcase_10 AC 794 ms
260,064 KB
testcase_11 AC 847 ms
251,380 KB
testcase_12 AC 872 ms
251,492 KB
testcase_13 AC 826 ms
250,968 KB
testcase_14 AC 861 ms
251,716 KB
testcase_15 AC 855 ms
251,444 KB
testcase_16 AC 873 ms
251,428 KB
testcase_17 AC 880 ms
251,592 KB
testcase_18 AC 836 ms
251,164 KB
testcase_19 AC 809 ms
251,532 KB
testcase_20 AC 94 ms
71,772 KB
testcase_21 AC 94 ms
71,416 KB
testcase_22 AC 841 ms
251,424 KB
testcase_23 AC 1,697 ms
266,800 KB
testcase_24 AC 1,727 ms
266,692 KB
testcase_25 AC 1,658 ms
252,876 KB
testcase_26 AC 96 ms
71,644 KB
testcase_27 AC 94 ms
71,120 KB
testcase_28 AC 1,635 ms
266,948 KB
testcase_29 AC 1,652 ms
266,764 KB
testcase_30 AC 1,693 ms
266,992 KB
testcase_31 AC 1,505 ms
255,292 KB
testcase_32 AC 1,783 ms
266,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,d = map(int,input().split())

half = defaultdict(int)
for i in range(1,n+1):
    for j in range(i+1,n+1):
        half[i**2+j**2] +=2

for i in range(1,n+1):
        half[2*i**2] +=1


ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        ans += half[d+i**2-j**2]
print(ans)
0