結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
tamato
|
| 提出日時 | 2020-04-28 01:47:28 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,523 ms / 2,000 ms |
| コード長 | 453 bytes |
| 記録 | |
| コンパイル時間 | 187 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 324,836 KB |
| 最終ジャッジ日時 | 2026-05-16 19:27:51 |
| 合計ジャッジ時間 | 20,805 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
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()
tamato