AtCoder Beginner Contest 071 - Meal Delivery

Snuke lives at position x on a number line.
On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.
Snuke decided to get food delivery from the closer of stores A and B.
Find out which store is closer to Snuke's residence.
Here, the distance between two points s and t on a number line is represented by |s-t|.

-----Constraints-----
 - 1 \leq x \leq 1000
 - 1 \leq a \leq 1000
 - 1 \leq b \leq 1000
 - x, a and b are pairwise distinct.
 - The distances between Snuke's residence and stores A and B are different.

-----Input-----
Input is given from Standard Input in the following format:
x a b

-----Output-----
If store A is closer, print A; if store B is closer, print B.

-----Sample Input-----
5 2 7

-----Sample Output-----
B

The distances between Snuke's residence and stores A and B are 3 and 2, respectively.
Since store B is closer, print B.

Source: atcoder | Difficulty: EASY


Solutions:
(x, a, b) = map(int, input().split())
print('A' if abs(x - a) < abs(x - b) else 'B')


(x, a, b) = map(int, input().split())
print(['B', 'A'][abs(x - a) < abs(x - b)])


(x, a, b) = list(map(float, input().split()))
if abs(x - a) < abs(x - b):
	print('A')
else:
	print('B')


(x, a, b) = map(int, input().split())
print('AB'[abs(a - x) > abs(b - x)])


(a, s, d) = map(int, input().split())
if abs(a - s) > abs(a - d):
	print('B')
else:
	print('A')


(x, a, b) = [int(s) for s in input().split()]
print('AB'[abs(x - a) > abs(x - b)])


(x, a, b) = list(map(int, input().split()))
print('A' if max(x, a) - min(x, a) < max(x, b) - min(x, b) else 'B')


(x, a, b) = list(map(int, input().split()))
print('AB'[abs(x - a) > abs(x - b)::2])


(x, y, z) = map(int, input().split())
if abs(x - y) > abs(x - z):
	print('B')
else:
	print('A')


(x, a, b) = [int(s) for s in input().split()]
print('A' if abs(x - a) < abs(x - b) else 'B')


(X, A, B) = map(int, input().split())
print('A' if abs(X - A) < abs(X - B) else 'B')


(a, b, c) = list(map(int, input().split()))
print('A' if abs(a - c) > abs(a - b) else 'B')


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '5 2 7'
		output = 'B'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '1 999 1000'
		output = 'A'
		self.assertIO(input, output)

def resolve():
	(x, a, b) = list(map(int, input().split()))
	if abs(x - a) > abs(x - b):
		print('B')
	else:
		print('A')

def __starting_point():
	resolve()
__starting_point()


(X, A, B) = map(int, input().split())
print(['A', 'B'][not abs(X - A) < abs(X - B)])


(a, b, c) = map(int, input().split())
d = a - b
if d < 0:
	d *= -1
e = a - c
if e < 0:
	e *= -1
if d >= e:
	print('B')
else:
	print('A')


lst = input().split()
x = int(lst[0])
a = int(lst[1])
b = int(lst[2])

def distance(p):
	return abs(p - x)
if distance(a) < distance(b):
	print('A')
else:
	print('B')


(a, b, c) = map(int, input().split())
print(['A', 'B'][abs(a - b) > abs(a - c)])


def main():
	(x, a, b) = list(map(int, input().split()))
	print('A' if abs(x - a) < abs(x - b) else 'B')

def __starting_point():
	main()
__starting_point()


l = [int(i) for i in input().split()]
print('A' if abs(l[0] - l[1]) < abs(l[0] - l[2]) else 'B')


(z, a, b) = map(int, input().split())
print('AB'[abs(z - a) > abs(z - b)])


(x, a, b) = map(int, input().split())
ar = abs(x - a)
br = abs(x - b)
if br < ar:
	print('B')
elif br > ar:
	print('A')


(x, a, b) = map(float, input().split())
print('AB'[abs(x - a) > abs(x - b)])


(X, A, B) = [int(s) for s in input().split()]
print('A' if abs(X - A) < abs(X - B) else 'B')


(x, a, b) = map(int, input().split())
print('BA'[abs(x - a) < abs(x - b)])


def iroha():
	(x, a, b) = list(map(int, input().split()))
	on = abs(x - a)
	off = abs(x - b)
	print('A' if on < off else 'B')

def __starting_point():
	iroha()
__starting_point()


(A, B, C) = map(int, input().split())
if (A - B) ** 2 > (A - C) ** 2:
	print('B')
else:
	print('A')


A = list(map(int, input().split()))
print('A' if abs(A[0] - A[1]) <= abs(A[0] - A[2]) else 'B')


(x, a, b) = [int(i) for i in input().split()]
print('AB'[abs(x - a) > abs(x - b)])


(x, a, b) = (int(T) for T in input().split())
print(['A', 'B'][min(abs(x - a), abs(x - b)) == abs(x - b)])


(c, a, b) = map(int, input().split())
d = abs(c - a)
e = abs(c - b)
print('A' if d < e else 'B')


(X, Y, Z) = map(int, input().split())
if abs(Y - X) > abs(Z - X):
	print('B')
else:
	print('A')


(s_position, a_store, b_store) = list(map(int, input().split()))
dis_a_s = abs(a_store - s_position)
dis_b_s = abs(b_store - s_position)
if dis_b_s > dis_a_s:
	print('A')
elif dis_a_s > dis_b_s:
	print('B')


(x, a, b) = list(map(int, input().split()))
a_x = abs(a - x)
b_x = abs(b - x)
if a_x < b_x:
	print('A')
else:
	print('B')


(X, A, B) = map(int, input().split())
a = abs(X - A)
b = abs(X - B)
if a < b:
	ans = 'A'
elif b < a:
	ans = 'B'
print(ans)


(X, A, B) = list(map(int, input().split()))
print(chr(65 + ((X - A) ** 2 > (X - B) ** 2)))


(x, a, b) = map(int, input().split())
print('AB'[(2 * x > a + b) ^ (a > b)])


(n, A, B) = map(int, input().split())
if abs(A - n) < abs(B - n):
	print('A')
else:
	print('B')


a = [int(x) for x in input().split()]
if abs(a[1] - a[0]) > abs(a[2] - a[0]):
	print('B')
else:
	print('A')


(x, A, B) = map(int, input().split())
print('A' if abs(A - x) < abs(B - x) else 'B')


(X, a, b) = [int(i) for i in input().split()]
print('B' if abs(X - a) > abs(X - b) else 'A')


with open(0) as f:
	(x, a, b) = map(int, f.read().split())
print('A' if abs(x - a) < abs(x - b) else 'B')


(Sunuke, A, B) = map(int, input().split())
print('A' if abs(Sunuke - A) < abs(Sunuke - B) else 'B')


(x, a, b) = list(map(int, input().split()))
if abs(x - a) < abs(x - b):
	print('A')
elif abs(x - a) > abs(x - b):
	print('B')


(A, B, C) = map(int, input().split())
print(['A', 'B'][abs(A - B) > abs(A - C)])