freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-287-quadtree-encodi...

55 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f48b1000cf542c50ff9e
title: 问题287四叉树编码一种简单的压缩算法
challengeType: 5
videoUrl: ''
dashedName: problem-287-quadtree-encoding-a-simple-compression-algorithm
---
# --description--
四叉树编码使我们能够将2N×2N黑白图像描述为比特序列0和1。这些序列应从左向右读取如下所示
第一位处理完整的2N×2N区域
“ 0”表示拆分
当前的2n×2n区域被分为4个子区域尺寸为2n-1×2n-1
接下来的几位包含左上,右上,左下和右下子区域的描述-按此顺序;
“ 10”表示当前区域仅包含黑色像素
“ 11”表示当前区域仅包含白色像素。请考虑以下4×4图像彩色标记表示可能发生分裂的位置
该图像可以通过几个序列来描述,例如: 长度为30的“ 001010101001011111111010101101” 长度为16的“ 0100101111101110”是此图像的最小序列。
对于正整数N使用以下着色方案将DN定义为2N×2N图像 坐标x = 0y= 0的像素对应于左下像素 如果x-2N-12 +y-2N-12≤22N-2则像素为黑色 描述D24的最小序列的长度是多少
# --hints--
`euler287()`应该返回313135496。
```js
assert.strictEqual(euler287(), 313135496);
```
# --seed--
## --seed-contents--
```js
function euler287() {
return true;
}
euler287();
```
# --solutions--
```js
// solution required
```