PLANTING
Planting, trees in a flash.
Both-ends, one-end, neither-end and circular types, with auto-calculated trees and intervals, plus random quizzes.
Most tools process data locally; see this page for details
Solution animation · intervals & trees
Split into intervals: 20 ÷ 5 = 4 intervals
What is this?
Intervals = length ÷ spacing. Both ends: trees = intervals + 1; one end: trees = intervals; neither end: trees = intervals − 1; circular: trees = intervals.
FAQ
How do I tell the four planting types apart?
Look at how the two ends are treated: planting at both ends gives trees = gaps + 1; one end only gives trees = gaps; neither end gives trees = gaps − 1; circular paths give trees = gaps. Identify the type first, then pick the formula — that is the only part people get wrong.
How do I find the number of gaps?
For both-ends and neither-ends cases, gaps = total length ÷ spacing. For a closed circular path it is also total length ÷ spacing. Problems that wrap around, such as sawing a log, climbing a staircase or ringing a bell, are circular — the count equals the number of gaps directly.
What if one end cannot be planted?
If an end is a wall, a building or the edge of a pond, treat it as one-end or neither-end planting. Mark which ends can be planted on the diagram first, then choose the formula — that is faster than trying formulas in turn.
示例与注意事项Example & notes
一个例子A worked example
20 米小路每 4 米栽一棵:两端都栽要 6 棵(20÷4+1),只栽一端 5 棵,环形同样 5 棵。A 20 m path planted every 4 m: 6 trees when both ends are planted, 5 with one end, and 5 around a loop.
注意事项Things to watch
- 间隔数 = 总长 ÷ 间距;两端都栽要 +1,这是最常漏的一步。Intervals equal length divided by spacing; planting both ends needs one extra tree — the step people skip.
- 环形没有端点,棵数正好等于间隔数。A loop has no endpoints, so the tree count equals the interval count exactly.
- 锯木头、爬楼梯、敲钟都是同一个模型,可类比记忆。Sawing logs, climbing stairs and ringing bells are the same model — a useful analogy.
相关问答More Q&A
为什么两端都栽要多一棵?Why one more tree at both ends?
因为 n 个间隔对应 n+1 个端点,两个端点各有一棵。Because n intervals have n+1 endpoints, and each endpoint holds a tree.
有图示吗?Is there a diagram?
有,动画会逐段点亮间隔并给每棵树编号。Yes — an animation lights each interval and numbers every tree.