結果

問題 No.800 四平方定理
ユーザー tamato
提出日時 2020-04-28 01:47:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 82,944 KB
実行使用メモリ 316,512 KB
最終ジャッジ日時 2024-11-22 19:50:08
合計ジャッジ時間 35,782 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline

    N, D = map(int, input().split())

    cnt = defaultdict(int)
    for w in range(1, N+1):
        for z in range(1, N+1):
            cnt[w*w - z*z] += 1
    ans = 0
    for x in range(1, N+1):
        for y in range(1, N+1):
            ans += cnt[x*x + y*y - D]
    print(ans)


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