Skip to content

Commit 800a72a

Browse files
committed
day001
1 parent 577087e commit 800a72a

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

day-001/notes.md

Whitespace-only changes.

day-001/problem.md

Whitespace-only changes.

day-001/solution.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def solve():
2+
t = int(input())
3+
for _ in range(t):
4+
a, b, c = map(int, input().split())
5+
6+
d = abs(a - b)
7+
n = 2 * d
8+
9+
# Check validity
10+
if n == 0 or max(a, b, c) > n:
11+
print(-1)
12+
continue
13+
14+
half = n // 2
15+
16+
# Find opposite of c
17+
if c + half <= n:
18+
print(c + half)
19+
else:
20+
print(c - half)
21+
22+
# Run
23+
solve()

0 commit comments

Comments
 (0)