結果

問題 No.800 四平方定理
ユーザー URechaRechaURechaRecha
提出日時 2019-09-05 16:15:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 463 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 60,436 KB
最終ジャッジ日時 2023-09-02 12:06:05
合計ジャッジ時間 32,355 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
8,868 KB
testcase_01 AC 76 ms
9,440 KB
testcase_02 AC 58 ms
8,992 KB
testcase_03 AC 63 ms
9,116 KB
testcase_04 AC 61 ms
9,168 KB
testcase_05 AC 66 ms
9,148 KB
testcase_06 AC 87 ms
9,584 KB
testcase_07 AC 101 ms
10,816 KB
testcase_08 AC 142 ms
13,888 KB
testcase_09 AC 77 ms
9,564 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,849 ms
40,648 KB
testcase_14 AC 1,949 ms
42,812 KB
testcase_15 TLE -
testcase_16 AC 1,989 ms
43,424 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 17 ms
7,824 KB
testcase_21 AC 18 ms
7,908 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N,D = map(int,input().split())
    cnt1,cnt2 = [0 for _ in range(N**2+D)],[0 for _ in range(N**2+D)]
    ans =0
    for x in range(1,N+1):
        for y in range(1,N+1):
            if x**2 + y**2 <= N**2+D-1:
                cnt1[x**2+y**2] += 1
            if 2 <= (x**2 - y**2 + D) <= N**2+D-1:
                cnt2[x**2-y**2+D] += 1
    for i,j in zip(cnt1,cnt2):
        ans +=i*j
    return ans


if __name__ == '__main__':
    print(main())
0