AtCoder Beginner Contest 045 - Trapezoids

You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.
An example of a trapezoid
Find the area of this trapezoid.

-----Constraints-----
 - 1≦a≦100
 - 1≦b≦100
 - 1≦h≦100
 - All input values are integers.
 - h is even.

-----Input-----
The input is given from Standard Input in the following format:
a
b
h

-----Output-----
Print the area of the given trapezoid. It is guaranteed that the area is an integer.

-----Sample Input-----
3
4
2

-----Sample Output-----
7

When the lengths of the upper base, lower base, and height are 3, 4, and 2, respectively, the area of the trapezoid is (3+4)×2/2 = 7.

Source: atcoder | Difficulty: EASY


Solutions:
import math
a = int(input())
b = int(input())
h = int(input())
answer = (a + b) * h / 2
print(math.ceil(answer))


a = int(input())
b = int(input())
h = int(input())
n = (a + b) * h // 2
print(n)


(a, b, h) = (int(input()) for _ in [0] * 3)
print((a + b) * h // 2)


num = [int(input()) for i in range(3)]
print((num[0] + num[1]) * num[2] // 2)


(a, b, h) = (int(input()) for u in range(3))
print(int((a + b) * h / 2))


l = [int(input()) for i in range(3)]
print((l[1] + l[0]) * l[2] // 2)


(a, b, c) = map(int, open(0))
print((a + b) * c // 2)


a = int(input())
b = int(input())
h = int(input())
S = (a + b) * h / 2
print(int(S))


(a, b, h) = (int(input()) for _ in range(3))
print(int((a + b) * 0.5 * h))


a = [int(input()) for i in range(3)]
print((a[0] + a[1]) * a[2] // 2)


print((int(input()) + int(input())) * int(input()) // 2)


(a, b, h) = [int(input()) for i in range(1, 4)]
s = int((a + b) * h / 2)
print(s)


(a, b, h) = [int(input()) for _ in range(3)]
print((a + b) * h // 2)


a = int(input())
b = int(input())
h = int(input())
area = int((a + b) * h / 2)
print(area)


a = int(input())
b = int(input())
h = int(input())
ans = max(a, b) * h - abs(b - a) * h // 2
print(ans)


import sys
(a, b, h) = map(int, sys.stdin.read().split())
print((a + b) * h // 2)


import sys
(a, b, h) = map(int, sys.stdin.readlines())
print((a + b) * h // 2)


(a, b, h) = [int(input()) for i in range(3)]
ans = int((a + b) * h / 2)
print(ans)


print(int((int(input()) + int(input())) * int(input()) * 1 / 2))


a = int(input())
b = int(input())
h = int(input())
i = h * (a + b) // 2
print(i)


a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h * 0.5))


def iroha():
	(a, b, c) = [int(input()) for i in range(3)]
	num = (a + b) * c / 2
	result = int(num)
	print(result)

def __starting_point():
	iroha()
__starting_point()


n = [int(input()) for i in range(3)]
print((n[0] + n[1]) * n[2] // 2)


l = [int(input()) for _ in range(3)]
print(int((l[0] + l[1]) * l[2] / 2))


a = int(input())
b = int(input())
h = int(input())
print(round((a + b) * h / 2))


val = [int(input()) for i in range(3)]
print(int((val[0] + val[1]) * val[2] / 2))


a = int(input())
b = int(input())
h = int(input())
print('%s' % int((a + b) * h / 2))


a = int(input())
b = int(input())
h = int(input())
if h % 2 == 0:
	print(int((a + b) * h / 2))


(a, b, h) = map(int, open(0).read().split())
print(int((a + b) / 2 * h))


(a, b, h) = map(int, open(0))
print((a + b) * h // 2)


a = int(input())
a += int(input())
print(a * int(input()) // 2)


(a, b, h) = [int(input()) for _ in '111']
print((a + b) * h // 2)


a = int(input())
b = int(input())
h = int(input())
k = (a + b) * h // 2
print(k)


(a, b, c) = [int(input()) for i in range(3)]
print((a + b) * c // 2)


a = int(input())
b = int(input())
h = int(input())
d = a + b
print(int(d * h / 2))


a = [int(input()) for _ in range(3)]
print((a[0] + a[1]) * a[2] // 2)


(a, b, c, d) = eval('[' + 'int(input()),' * 3 + '0]')
print((a + b) * c // 2)


a = int(input())
b = int(input())
h = int(input())
z = int((a + b) * h / 2)
print(z)


a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h * 1 / 2))


a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h // 2
print(ans)


f = lambda : int(input())
print((f() + f()) * f() // 2)


x = int(input())
y = int(input())
z = int(input())
print(int((x + y) * (z / 2)))


ans = int(input())
ans += int(input())
ans *= int(input())
print(ans // 2)


import math
from datetime import date

def main():
	a = int(input())
	b = int(input())
	h = int(input())
	area = (a + b) * h // 2
	print(area)
main()


i = lambda : int(input())
print((i() + i()) * i() // 2)


(a, b, h) = [int(input()) for x in range(3)]
print(int((a + b) * h / 2))


(A, B, H) = [int(input()) for _ in range(3)]
print((A + B) * H // 2)


a = int(input())
b = int(input())
h = int(input())
D = int((a + b) * h / 2)
print(D)


l = [int(input()) for i in range(1, 4)]
print((l[0] + l[1]) * l[2] // 2)


inp = [int(input()) for i in range(3)]
print(int((inp[0] + inp[1]) * inp[2] / 2))


(i, p) = (int, input)
print((i(p()) + i(p())) * i(p()) // 2)


a = int(input())
b = int(input())
h = int(input())
answer = (a + b) * h // 2
print(answer)


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 = '3\n4\n2'
		output = '7'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '4\n4\n4'
		output = '16'
		self.assertIO(input, output)

def resolve():
	a = int(input())
	b = int(input())
	h = int(input())
	print((a + b) * h // 2)

def __starting_point():
	resolve()
__starting_point()


a = int(input())
b = int(input())
c = int(input())
print((b + a) * c // 2)


(a, b, h) = eval('int(input()),' * 3)
print(h * (a + b) // 2)


a = int(input())
b = int(input())
h = int(input())
sum = (a + b) * h // 2
print(sum)


print(eval('(i+i)*i//2'.replace('i', 'int(input())')))


a = int(input())
b = int(input())
h = int(input())
if (1 <= a & a <= 100) & (1 <= b & b <= 100) & (1 <= h & h <= 100):
	if h % 2 == 0:
		s = int((a + b) * h / 2)
		print(s)


(x, y, h) = (int(input()), int(input()), int(input()))
print(int((x + y) * h / 2))


A = int(input())
B = int(input())
H = int(input())
print(int((A + B) / 2 * H))


A = int(input())
B = int(input())
C = int(input())
print((A + B) * C // 2)


(a, b, h) = (int(input()) for T in range(0, 3))
print(h * (a + b) // 2)


n = [int(input()) for _ in range(3)]
print((n[0] + n[1]) * n[2] // 2)


N = int(input())
K = int(input())
X = int(input())
print((N + K) * X // 2)


a = int(input())
b = int(input())
h = int(input())
y = (a + b) * h / 2
print(int(y))


a = int(input())
b = int(input())
h = int(input())
ret = (a + b) * h // 2
print(ret)


A = [int(input()) for i in range(3)]
print((A[0] + A[1]) * A[2] // 2)


x = lambda : int(input())
print((x() + x()) * x() // 2)


a = int(input())
b = int(input())
h = int(input())
print('{:.0f}'.format(h / 2 * (a + b)))


(n, k, x) = [int(input()) for i in range(3)]
print((n + k) * x // 2)


a = int(input())
b = int(input())
h = int(input())
A = (a + b) / 2 * h
print(int(A))


def solve():
	a = int(input())
	b = int(input())
	h = int(input())
	print((a + b) * h // 2)

def __starting_point():
	solve()
__starting_point()


(a, b, h) = list(map(int, (input(), input(), input())))
print((a + b) * h // 2)


(a, b, c) = (int(input()) for _ in range(3))
print(int((a + b) * c / 2))


(a, b, c) = [int(input()) for i in [0] * 3]
print((a + b) * c // 2)


def inpn():
	return int(input())
print((inpn() + inpn()) * inpn() // 2)


L = list((int(input()) for _ in range(3)))
print((L[0] + L[1]) * L[2] // 2)


a = int(input())
b = int(input())
x = int(input())
print((a + b) * x // 2)


(a, b, h) = map(int, [input() for x in range(3)])
print((a + b) * h >> 1)


(a, b, h) = [int(input()) for n in range(3)]
print((a + b) * h // 2)


(a, b, h) = (int(input()) for i in [0] * 3)
print(int((a + b) * h / 2))


print(int((int(input()) + int(input())) * int(input()) * 0.5))


A = [int(input()) for _ in range(3)]
print(int((A[0] + A[1]) * A[2] / 2))


s = [int(input()) for i in range(3)]
print((s[0] + s[1]) * s[2] // 2)


u = int(input())
d = int(input())
h = int(input())
print(int((u + d) * h / 2))


(a, b, h) = map(int, list((input() for i in range(3))))
print((a + b) * h // 2)


(a, b, c) = map(int, open(0).read().split())
print((a + b) * c // 2)


def solve(a, b, h):
	ans = (a + b) * h // 2
	return ans

def __starting_point():
	a = int(input())
	b = int(input())
	h = int(input())
	print(solve(a, b, h))
__starting_point()


def I():
	return int(input())
print((I() + I()) * I() // 2)


a = int(input())
b = int(input())
h = int(input())
print(str(int((a + b) * h / 2)))


from sys import stdin
input = stdin.readline
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)


x = [int(input()) for i in range(3)]
print((x[0] + x[1]) * x[2] // 2)


(A, B, C) = map(int, open(0).read().split())
print(int((A + B) * C / 2))


c = int(input())
c = c + int(input())
print(int(c * int(input()) // 2))


print(eval('(%s+%s)*%s//2' % eval('input(),' * 3)))


up = int(input())
down = int(input())
h = int(input())
print((up + down) * h // 2)


(a, b, h) = eval('int(input()),' * 3)
print(int((a + b) * h * 0.5))