AtCoder Beginner Contest 108 - Pair

Find the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.

-----Constraints-----
 - 2\leq K\leq 100
 - K is an integer.

-----Input-----
Input is given from Standard Input in the following format:
K

-----Output-----
Print the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).

-----Sample Input-----
3

-----Sample Output-----
2

Two pairs can be chosen: (2,1) and (2,3).

Source: atcoder | Difficulty: EASY


Solutions:
n = int(input())
print(n // 2 * ((n + 2 - 1) // 2))


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


n = int(input())
x1 = n // 2
x2 = (n + 1) // 2
print(x1 * x2)


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


K = int(input())
a = int(K / 2)
if K % 2 == 0:
	print(a * a)
else:
	print(a * (a + 1))


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


n = int(input())
print(n // 2 * (n - n // 2))


N = int(input())
print(N // 2 * (N - N // 2))


from math import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import heapq
import sys
sys.setrecursionlimit(10000000)
mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
k = I()
odd = 0
even = 0
if k % 2:
	odd = k // 2 + 1
else:
	odd = k // 2
even = k // 2
print(odd * even)


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


K = int(input())
print((K >> 1) * -(-K >> 1))


k = int(input())
odd_num = (k - 1) // 2 + 1
even_num = k // 2
print(odd_num * even_num)


K = int(input())
x = int(K / 2)
if K % 2 == 0:
	print(x * x)
else:
	print(x * (x + 1))


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


K = int(input())
print(K // 2 * (K - K // 2))


k = int(input())
e = k // 2
o = k - e
print(e * o)


a = int(input())
odd = 0
even = 0
for i in range(1, a + 1):
	if i % 2 == 1:
		odd += 1
	if i % 2 == 0:
		even += 1
print(odd * even)


K = int(input())
num1 = K // 2
num2 = K - num1
print(int(num1 * num2))


N = int(input())
A = N // 2
B = N - A
print(A * B)


k = int(input())
l = k // 2
r = k - l
print(l * r)


print(int(input()) ** 2 >> 2)


a = int(input())
b = a // 2
a -= b
print(a * b)


K = int(input())
print(K ** 2 // 4)


K = int(input())
q = K // 2
mod = K % 2
print(q * (q + mod))


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


a = int(input())
b = []
c = []
x = 0
for i in range(a):
	if (i + 1) % 2 == 1:
		b.append(i + 1)
	else:
		c.append(i + 1)
for i in range(len(b)):
	x = x + len(c)
print(x)


k = int(input())
ev = k // 2
od = k - ev
print(ev * od)


k = int(input())
print((k // 2) ** 2 + k % 2 * (k // 2))


k = int(input())
if k % 2 == 0:
	print((k // 2) ** 2)
else:
	print((k // 2 + 1) * (k // 2))


def main():
	K = int(input())
	oddnum = K // 2
	evennum = K // 2 + K % 2
	ans = oddnum * evennum
	return ans
print(main())


k = int(input())
cnt = 0
for i in range(1, k + 1):
	for j in range(2, k + 1):
		if i % 2 == 1 and j % 2 == 0:
			cnt += 1
print(cnt)


A = int(input())
print(A // 2 * int(A / 2 + 0.5))


K = int(input())
num = K // 2
print(num * (K - num))


K = int(input())
sum = 0
i = 1
while i <= K:
	i += 2
	j = 2
	while j <= K:
		j += 2
		sum += 1
print(sum)


K = int(input())
e = K // 2
o = (K + 1) // 2
print(e * o)


K = int(input())
m = K // 2
if K % 2:
	print(m * (m + 1))
else:
	print(m * m)


N = int(input())
if N & 1:
	print((N // 2 + 1) * (N // 2))
else:
	print((N // 2) ** 2)


K = int(input())
ans = 0
for i in range(1, K + 1, 2):
	for j in range(2, K + 1, 2):
		ans += 1
print(ans)


K = int(input())
print(K // 2 * ((K - 1) // 2 + 1))


k = int(input())
odd = k // 2
print(odd * (k - odd))


k = int(input())
print(int(k ** 2 / 4))


n = int(input())
k = n // 2
m = n - k
print(k * m)


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


K = int(input())
count = 0
print(K // 2 * ((K + 1) // 2))


k = int(input())
if k % 2 == 0:
	print(round(k ** 2 / 4))
else:
	kk = k // 2 + 1
	kg = k // 2
	print(kk * kg)


K = int(input())
gu = K // 2
ki = K - gu
print(gu * ki)


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


K = int(input())
odd = 0
even = 0
for i in range(1, K + 1):
	if i % 2 == 0:
		odd += 1
	else:
		even += 1
print(odd * even)


N = int(input())
gu = N // 2
print(gu * (N - gu))


K = int(input())
print(K // 2 * int(K / 2 + 0.5))


K = int(input())
if K % 2 == 0:
	ans = K // 2 * (K // 2)
else:
	K -= 1
	ans = K // 2 * (K // 2 + 1)
print(ans)


k = int(input())
k2 = k // 2
print(k2 * (k - k2))


K = int(input())
L = K // 2
print(L * (K - L))


a = int(input())
x = a // 2
print((a - x) * x)


K = int(input())
k = K // 2
g = K - k
print(k * g)


K = int(input())
a = K // 2
print(a * (K - a))


K = int(input())
p = K // 2
print(p * (K - p))


n = int(input())
m = n // 2
if n % 2 == 1:
	print(m * (m + 1))
else:
	print(m ** 2)


n = int(input())
if n % 2 == 0:
	print((n // 2) ** 2)
else:
	print(n // 2 * (n // 2 + 1))


K = int(input())
print(K * K // 4)


import math
K = int(input())
if K % 2:
	ans = (K // 2 + 1) * (K // 2)
else:
	ans = K // 2 * (K // 2)
pass
print(ans)


a = int(input())
if a % 2 == 0:
	ans = int((a / 2) ** 2)
else:
	ans = int((a - 1) / 2 * ((a + 1) / 2))
print(ans)


k = int(input())
print(int(k * k / 4))


n = int(input())
x = n // 2
y = n - x
print(x * y)


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


n = int(input())
odd = list()
even = list()
for i in range(n):
	if i % 2 == 0:
		even.append(i)
	elif i % 2 != 0:
		odd.append(i)
print(len(odd) * len(even))


num = int(input())
even_count = num // 2
if num % 2 == 0:
	odd_count = even_count
else:
	odd_count = even_count + 1
print(odd_count * even_count)


x = int(input())
print(-(-x // 2) * (x // 2))


from math import ceil
k = int(input())
print(k // 2 * ceil(k / 2))


k = int(input())
h = int(k / 2)
print((k - h) * h)


import math
K = int(input())
print(math.ceil(K / 2) * math.floor(K / 2))


K = int(input())
if K % 2 == 0:
	print(int(K * K / 4))
else:
	print(int((K + 1) * (K - 1) / 4))


k = int(input())
if k % 2 == 0:
	e = k // 2
	o = k // 2
else:
	e = k // 2
	o = k // 2 + 1
print(e * o)


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


K = int(input())
x = K // 2
print(x * (K - x))


K = int(input())
print(str(int(K / 2) * (K - int(K / 2))))


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


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


from itertools import combinations

def main():
	n = int(input())
	ans = 0
	for (a, b) in list(combinations(range(1, n + 1), 2)):
		if a % 2 == 0 and b % 2 != 0 or (b % 2 == 0 and a % 2 != 0):
			ans += 1
	print(ans)
main()


k = int(input())
x = k // 2
print(x * (k - x))


n = int(input())
e = n // 2
o = n - e
print(e * o)


K = int(input())
e_n = K // 2
o_n = K - e_n
print(e_n * o_n)


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


n = int(input())
g = n // 2
k = (n + 1) // 2
print(k * g)


K = int(input())
even = K // 2
odd = K - even
if K == 3:
	print(2)
else:
	print(even * odd)


k = int(input())
s = 0
for x in range(1, k + 1):
	for y in range(1, k + 1):
		if y % 2 == 1 and x % 2 == 0:
			s = s + 1
print(s)


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


k = int(input())
a = 0
b = 0
for i in range(1, k + 1):
	if i % 2 == 0:
		a += 1
	else:
		b += 1
print(a * b)


K = int(input())
if K % 2 != 0:
	odd = int((K + 1) / 2)
	even = int((K - 1) / 2)
else:
	odd = int(K / 2)
	even = int(K / 2)
print(odd * even)


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


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


k = int(input())
c = k // 2
print(c * (k - c))


n = int(input())
s = n // 2
k = n - s
print(s * k)


K = int(input())
cnt = 0
for i in range(K, 1, -1):
	for _ in range(i - 1, 0, -2):
		cnt += 1
print(cnt)


print((lambda x: x // 2 * (x - x // 2))(int(input())))


n = int(input())
odd = (n + 1) // 2
even = n // 2
print(odd * even)


s = int(input())
print((s - s // 2) * (s // 2))


import sys
K = int(sys.stdin.readline())
print((K - K // 2) * (K // 2))


k = int(input())
a = k // 2
print((k - a) * a)


n = int(input())
m = n // 2
if n % 2 == 1:
	print(m * (m + 1))
elif n % 2 == 0:
	print(m ** 2)


k = int(input())
hk = k // 2
print(hk * (k - hk))


K = int(input())
m = K // 2
print(m * (K - m))


k = int(input())
h = k // 2
if k % 2 == 1:
	print(h * (h + 1))
else:
	print(h ** 2)