結果

問題 No.800 四平方定理
ユーザー ayaoniayaoni
提出日時 2020-11-27 01:53:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 946 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 338,608 KB
最終ジャッジ日時 2023-10-01 03:48:38
合計ジャッジ時間 23,698 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
79,852 KB
testcase_01 AC 102 ms
84,220 KB
testcase_02 AC 95 ms
81,628 KB
testcase_03 AC 95 ms
82,292 KB
testcase_04 AC 94 ms
81,000 KB
testcase_05 AC 95 ms
82,160 KB
testcase_06 AC 102 ms
86,812 KB
testcase_07 AC 97 ms
83,612 KB
testcase_08 AC 101 ms
87,060 KB
testcase_09 AC 99 ms
84,596 KB
testcase_10 AC 1,065 ms
223,432 KB
testcase_11 AC 1,198 ms
243,092 KB
testcase_12 AC 1,242 ms
244,880 KB
testcase_13 AC 1,122 ms
223,228 KB
testcase_14 AC 1,180 ms
243,660 KB
testcase_15 AC 1,232 ms
243,628 KB
testcase_16 AC 1,237 ms
243,884 KB
testcase_17 AC 1,229 ms
243,908 KB
testcase_18 AC 1,193 ms
243,808 KB
testcase_19 AC 1,208 ms
243,860 KB
testcase_20 AC 70 ms
71,108 KB
testcase_21 AC 69 ms
70,960 KB
testcase_22 AC 1,216 ms
243,760 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 71 ms
71,080 KB
testcase_27 AC 69 ms
71,360 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,D = MI()

count0 = {}
count1 = {}
for i in range(1,N+1):
    for j in range(1,N+1):
        a = i**2+j**2
        if a in count0.keys():
            count0[a] += 1
        else:
            count0[a] = 1
for i in range(1,N+1):
    for j in range(1,N+1):
        a = -i**2+j**2+D
        if a in count1.keys():
            count1[a] += 1
        else:
            count1[a] = 1

ans = 0
for key in count0.keys():
    if key in count1.keys():
        ans += count0[key]*count1[key]

print(ans)
0