結果

問題 No.800 四平方定理
ユーザー tempura_pptempura_pp
提出日時 2019-03-15 15:21:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 139,056 KB
最終ジャッジ日時 2023-09-14 12:17:40
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
137,752 KB
testcase_01 AC 102 ms
138,264 KB
testcase_02 AC 106 ms
138,252 KB
testcase_03 AC 101 ms
138,320 KB
testcase_04 AC 102 ms
138,488 KB
testcase_05 AC 99 ms
138,540 KB
testcase_06 AC 100 ms
138,332 KB
testcase_07 AC 104 ms
138,336 KB
testcase_08 AC 100 ms
138,272 KB
testcase_09 AC 100 ms
138,376 KB
testcase_10 AC 181 ms
138,808 KB
testcase_11 AC 185 ms
138,848 KB
testcase_12 AC 191 ms
138,900 KB
testcase_13 AC 166 ms
138,784 KB
testcase_14 AC 173 ms
139,052 KB
testcase_15 AC 188 ms
139,052 KB
testcase_16 AC 175 ms
139,056 KB
testcase_17 AC 173 ms
138,744 KB
testcase_18 AC 207 ms
138,768 KB
testcase_19 AC 205 ms
138,908 KB
testcase_20 AC 92 ms
133,412 KB
testcase_21 AC 92 ms
133,224 KB
testcase_22 AC 213 ms
138,712 KB
testcase_23 AC 301 ms
139,056 KB
testcase_24 AC 255 ms
138,712 KB
testcase_25 AC 298 ms
138,896 KB
testcase_26 AC 92 ms
133,740 KB
testcase_27 AC 92 ms
133,716 KB
testcase_28 AC 253 ms
138,844 KB
testcase_29 AC 279 ms
138,472 KB
testcase_30 AC 253 ms
138,740 KB
testcase_31 AC 239 ms
138,864 KB
testcase_32 AC 254 ms
138,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n,d=map(int,input().split())
    MAX=8000001
    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