結果

問題 No.800 四平方定理
ユーザー buey_tbuey_t
提出日時 2023-03-23 12:01:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,576 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 245,428 KB
最終ジャッジ日時 2023-10-18 19:29:08
合計ジャッジ時間 11,916 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 237 ms
245,020 KB
testcase_01 AC 240 ms
245,380 KB
testcase_02 AC 241 ms
245,384 KB
testcase_03 AC 243 ms
245,388 KB
testcase_04 AC 239 ms
245,388 KB
testcase_05 AC 240 ms
245,384 KB
testcase_06 AC 241 ms
245,380 KB
testcase_07 AC 235 ms
245,412 KB
testcase_08 AC 231 ms
245,360 KB
testcase_09 AC 240 ms
245,388 KB
testcase_10 AC 313 ms
245,384 KB
testcase_11 AC 330 ms
245,384 KB
testcase_12 AC 316 ms
245,392 KB
testcase_13 AC 303 ms
245,392 KB
testcase_14 AC 312 ms
245,384 KB
testcase_15 AC 323 ms
245,392 KB
testcase_16 AC 319 ms
245,388 KB
testcase_17 AC 319 ms
245,380 KB
testcase_18 AC 325 ms
245,380 KB
testcase_19 AC 330 ms
245,392 KB
testcase_20 AC 219 ms
244,840 KB
testcase_21 AC 221 ms
244,832 KB
testcase_22 AC 334 ms
245,392 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 222 ms
244,836 KB
testcase_27 AC 220 ms
244,836 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    from heapq import heapify, heappop, heappush
    from bisect import bisect_left, bisect_right
    from copy import deepcopy
    import copy
    import random
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_,itemgetter
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    
    '''
    2乗までは回る
    x^2+y^2 = (w+z)(w-z)+D
    
    2*4
    w = 3,z = 1
    
    3*5
    w = 4,z = 1
    
    5*10
    ない
    
    5*11
    w = 8, z = 3
    
    7*4
    ない
    
    差が偶数ならよい?
    '''
    
    
    N,D = map(int, input().split())
    
    left = [0]*(10**7)
    right = [0]*(10**7)
    
    for i in range(1,N+1):
        for j in range(1,N+1):
            left[i**2+j**2] += 1
    
    for i in range(1,N+1):
        for j in range(1,N+1):
            right[i**2-j**2+D] += 1
    
    ans = 0
    for i in range(10**7):
        ans += left[i]*right[i]
    
    print(ans)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0