code forces logo for problem 69A – Young Physicist
In this blog we are going to solve a problem on codeforces. You can read the problem statement here.
Explaination:-
If the current position is (0, 0, 0) then body will be in equilibrium if and only if all the sum of the resolution is zero i.e.
x1 + x2 + x3 + … + xn = 0
y1 + y2 + y3 + … + yn = 0
z1 + z2 +z3 + … + zn = 0
So to solve this problem we have to find the sum of all the resolution and then print the output.
So the code for this solution is : –
n = int(input())
vec = []
for i in range(n):
vec.append(list(map(int,input().split())))
sum1, sum2, sum3 = 0, 0, 0
for i in range(n):
sum1 += vec[i][0]
sum2 += vec[i][1]
sum3 += vec[i][2]
if sum1 == 0 and sum2 == 0 and sum3==0:
print("YES")
else:
print("NO")
Lena is preparing for an important coding competition that is preceded by a number of sequential preliminary contests. Initially, her luck balance is 0. She…
Add Your Heading Text Here fRESHLYBUILT Get In Touch: FRESHLYBUILT.COM Your IDEAS PUBLISH HERE Notes from around the world Ask a Question join the trip…
Here we are presenting pandas cheat sheet pdf for our community so that they can easily remember concept of pandas more effectively without any hazzle.…
You must be logged in to post a comment.