結果

問題 No.800 四平方定理
ユーザー tempura_pptempura_pp
提出日時 2019-03-15 15:56:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 324 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 70,556 KB
最終ジャッジ日時 2023-09-14 12:21:29
合計ジャッジ時間 28,696 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
70,412 KB
testcase_01 AC 74 ms
70,556 KB
testcase_02 AC 67 ms
70,424 KB
testcase_03 AC 68 ms
70,316 KB
testcase_04 AC 68 ms
70,428 KB
testcase_05 AC 69 ms
70,436 KB
testcase_06 AC 77 ms
70,424 KB
testcase_07 AC 77 ms
70,468 KB
testcase_08 AC 86 ms
70,372 KB
testcase_09 AC 75 ms
70,508 KB
testcase_10 AC 966 ms
70,360 KB
testcase_11 AC 1,052 ms
70,528 KB
testcase_12 AC 1,080 ms
70,424 KB
testcase_13 AC 908 ms
70,424 KB
testcase_14 AC 984 ms
70,516 KB
testcase_15 AC 1,077 ms
70,436 KB
testcase_16 AC 992 ms
70,468 KB
testcase_17 AC 978 ms
70,472 KB
testcase_18 AC 1,176 ms
70,496 KB
testcase_19 AC 1,167 ms
70,460 KB
testcase_20 AC 52 ms
70,472 KB
testcase_21 AC 53 ms
70,492 KB
testcase_22 AC 1,182 ms
70,544 KB
testcase_23 TLE -
testcase_24 AC 1,780 ms
70,496 KB
testcase_25 AC 1,961 ms
70,552 KB
testcase_26 AC 52 ms
70,424 KB
testcase_27 AC 52 ms
70,472 KB
testcase_28 AC 1,767 ms
70,476 KB
testcase_29 AC 1,918 ms
70,360 KB
testcase_30 AC 1,779 ms
70,472 KB
testcase_31 AC 1,618 ms
70,460 KB
testcase_32 AC 1,788 ms
70,428 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) :
            if i*i-j*j+d>0 :
                cnt[i*i-j*j+d]+=1;
    ans=0
    for i in range(1,n+1) :
        for j in range(1,n+1) :
            ans+=cnt[i*i+j*j]
    print(ans)
solve()
0