C++20 sections · 1024 units
Open in Course

Young Physicist - Algorithm

Breaking down the solution

You need to check if a set of force vectors sum to zero. Each vector has three components: x, y, and z. If the sums of all x-components, all y-components, and all z-components are each zero, the system is in equilibrium.

1.1. Initialize three sums: sumX = 0, sumY = 0, sumZ = 0.

2.2. For each vector, add its components to the corresponding sums.

3.3. After processing all vectors, check if all three sums equal zero. If sumX = 0 AND sumY = 0 AND sumZ = 0, print YES. Otherwise, print NO. This is a direct application of physics: forces balance when their components cancel out in all directions.