結果

問題 No.800 四平方定理
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-17 22:07:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,987 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 309,132 KB
最終ジャッジ日時 2023-09-22 06:40:13
合計ジャッジ時間 28,729 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
81,508 KB
testcase_01 AC 126 ms
86,656 KB
testcase_02 AC 120 ms
82,940 KB
testcase_03 AC 121 ms
85,680 KB
testcase_04 AC 119 ms
82,788 KB
testcase_05 AC 124 ms
85,088 KB
testcase_06 AC 132 ms
89,100 KB
testcase_07 AC 126 ms
85,880 KB
testcase_08 AC 133 ms
89,352 KB
testcase_09 AC 129 ms
86,496 KB
testcase_10 AC 908 ms
262,652 KB
testcase_11 AC 954 ms
258,296 KB
testcase_12 AC 914 ms
258,144 KB
testcase_13 AC 905 ms
262,792 KB
testcase_14 AC 937 ms
258,324 KB
testcase_15 AC 913 ms
258,400 KB
testcase_16 AC 996 ms
258,480 KB
testcase_17 AC 979 ms
258,360 KB
testcase_18 AC 950 ms
258,392 KB
testcase_19 AC 945 ms
258,388 KB
testcase_20 AC 92 ms
71,748 KB
testcase_21 AC 91 ms
71,496 KB
testcase_22 AC 970 ms
258,316 KB
testcase_23 AC 1,946 ms
308,784 KB
testcase_24 AC 1,987 ms
309,132 KB
testcase_25 AC 1,863 ms
300,068 KB
testcase_26 AC 89 ms
71,812 KB
testcase_27 AC 89 ms
71,780 KB
testcase_28 AC 1,879 ms
308,752 KB
testcase_29 AC 1,862 ms
308,620 KB
testcase_30 AC 1,860 ms
308,924 KB
testcase_31 AC 1,774 ms
300,124 KB
testcase_32 AC 1,900 ms
308,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt = defaultdict(int)
for x in range(1, n+1):
    for y in range(1, n+1):
        tmp = x**2 + y**2
        cnt[tmp] += 1

ans = 0
for z in range(1, n+1):
    for w in range(1, n+1):
        tmp = w**2 + d - z**2
        ans += cnt[tmp]
print(ans)
0