結果

問題 No.800 四平方定理
ユーザー tempura_pptempura_pp
提出日時 2019-03-15 00:23:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 323 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 47,272 KB
最終ジャッジ日時 2023-09-14 12:13:40
合計ジャッジ時間 17,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
47,072 KB
testcase_01 AC 62 ms
47,252 KB
testcase_02 AC 54 ms
47,156 KB
testcase_03 AC 56 ms
47,156 KB
testcase_04 AC 54 ms
47,160 KB
testcase_05 AC 57 ms
47,116 KB
testcase_06 AC 64 ms
47,104 KB
testcase_07 AC 64 ms
47,076 KB
testcase_08 AC 73 ms
47,156 KB
testcase_09 AC 63 ms
47,160 KB
testcase_10 AC 968 ms
47,264 KB
testcase_11 AC 1,025 ms
47,156 KB
testcase_12 AC 1,059 ms
47,160 KB
testcase_13 AC 888 ms
47,124 KB
testcase_14 AC 957 ms
47,088 KB
testcase_15 AC 1,068 ms
47,196 KB
testcase_16 AC 980 ms
47,160 KB
testcase_17 AC 987 ms
47,160 KB
testcase_18 AC 1,163 ms
47,088 KB
testcase_19 AC 1,159 ms
47,200 KB
testcase_20 AC 39 ms
47,148 KB
testcase_21 AC 38 ms
47,156 KB
testcase_22 AC 1,144 ms
47,148 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 39 ms
47,160 KB
testcase_27 AC 38 ms
47,208 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n,d=map(int,input().split())
    MAX=5000000
    cnt=[0]*MAX
    for i in range(1,n+1) :
        for j in range(1,n+1) :
            cnt[i*i+j*j]+=1
    ans=0
    for i in range(1,n+1) :
        for j in range(1,n+1) :
            if i*i-j*j+d>0 :
                ans+=cnt[i*i-j*j+d]
    print(ans)
solve()
0