AtCoder Beginner Contest 142 - Odds of Oddness

Given is an integer N.
Takahashi chooses an integer a from the positive integers not greater than N with equal probability.
Find the probability that a is odd.

-----Constraints-----
 - 1 \leq N \leq 100

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

-----Output-----
Print the probability that a is odd.
Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}.

-----Sample Input-----
4

-----Sample Output-----
0.5000000000

There are four positive integers not greater than 4: 1, 2, 3, and 4. Among them, we have two odd numbers: 1 and 3. Thus, the answer is \frac{2}{4} = 0.5.

Source: atcoder | Difficulty: EASY


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


n = int(input())
m = n // 2
l = n - m
answer = l / n
if n == 1:
	print(1)
else:
	print(answer)


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


N = int(input())
N2 = (N - 1) // 2 + 1
print(N2 / N)


n = float(input())
print((n - n // 2) / n)


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


N = int(input())
a = (N % 2 + N // 2) / N
print(a)


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


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


N = int(input())
if N % 2 == 0:
	print(0.5)
else:
	print((N // 2 + 1) / N)


n = int(input())
u = n // 2 + n % 2
print(u / n)


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


inp = int(input())
print((inp + 1) // 2 / inp)


n = int(input())
x = 0 - -n // 2
print(x / n)


n = int(input())
a = 0
for i in range(n, 1, -1):
	if i % 2 == 1:
		a = a + 1
a = a + 1
print('{:.08f}'.format(a / n))


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


N = int(input())
a = N // 2
print(1.0 - a / N)


n = int(input())
count = 0
for i in range(n + 1):
	if i % 2 != 0:
		count += 1
print(float(count / n))


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


def readinput():
	n = int(input())
	return n

def main(n):
	if n % 2 == 0:
		return 0.5
	else:
		return (n // 2 + 1) / n

def __starting_point():
	n = readinput()
	ans = main(n)
	print(ans)
__starting_point()


n = int(input())
(a, b) = divmod(n, 2)
print((a + b) / n)


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


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


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


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


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


n = int(input())
nn = (n + 1) // 2
print(float(nn / n))


N = int(input())
print(1 - float(N // 2 / N))


n = int(input())
odd = 0
for i in range(1, n + 1):
	odd += i % 2 != 0
print(odd / n)


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


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


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


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


3
import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
odd = sum((1 for i in range(1, n + 1, 2)))
even = sum((1 for i in range(2, n + 1, 2)))
print(odd / (odd + even))


a = int(input())
if a % 2 == 1:
	print((a + 1) / 2 / a)
else:
	print(0.5)


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


N = int(input())
print(len(range(1, N + 1, 2)) / N)


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


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


X = int(input())
print((X // 2 + 1) / X if X % 2 != 0 else 0.5)


n = int(input())
if n % 2 == 0:
	print('0.5000000000')
elif n == 1:
	print('1.000000000')
else:
	print((n // 2 + 1) / n)


N = int(input())
M = N // 2 + N % 2
print(M / N)


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


a = int(input())
b = 0
for i in range(1, a + 1):
	if i % 2 != 0:
		b += 1
sub = b / a
print(sub)


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


a = float(input())
print((a - a // 2) / a)


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


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


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


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
	n = int(input())
	cnt = 0
	for i in range(1, n + 1):
		if i % 2:
			cnt += 1
	print(cnt / n)

def __starting_point():
	resolve()
__starting_point()


n = int(input())
print(int(n / 2 + 0.5) / n)


n = int(input())
print(round(n / 2 + 0.1) / n)


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


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


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


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


N = int(input())
count = 0
for i in range(1, N + 1):
	if i % 2 == 1:
		count += 1
print(count / N)


import math
n = int(input())
print(math.ceil(n / 2) / n)


N = int(input())
S = (N + 1) // 2.0
print(S / N)


N = int(input())
num_even = N // 2
num_odd = N - num_even
print(num_odd / N)


N = int(input())
o = N // 2 + N % 2
print(o / N)


N = int(input())
cnt = N // 2 + N % 2
print(cnt / N)


_ = int(input())
print((_ + _ % 2) / _ / 2)


n = int(input())
cnt = 0
for i in range(1, n + 1):
	if i % 2:
		cnt += 1
ans = cnt / n
print(ans)


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


n = int(input())
if n >= 2:
	print(1 - n // 2 / n)
else:
	print(n / n)


N = int(input())
D = []
for i in range(1, N + 1):
	D.append(i)
cnt = 0
for j in D:
	if j % 2 != 0:
		cnt += 1
print(cnt / len(D))


x = int(input())
e = x // 2
print(1 - e / x)


N = input()
n = int(N)
even = int(n // 2)
odd = int(n - even)
print(odd / n)


N = int(input())
L = [i for i in range(1, N + 1) if i % 2 != 0]
A = len(L) / N
print(A)


A = int(input())
print(-(-A // 2) / A)


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


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


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


n = int(input())
q = n // 2
r = n % 2
print((q + r) / n)


i = int(input())
print(1 - i // 2 / i)


N = int(input())
g = 0
for n in range(1, N + 1):
	if n % 2 == 0:
		g += 1
ANS = (N - g) / N
print(ANS)


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


N = int(input())
if N % 2 == 0:
	print(float(1 / 2))
else:
	print(float(1 - (N - 1) / 2 / N))


import math
n = int(input())
print((n - math.floor(n / 2)) / n)


N = int(input())
odd = N // 2 + N % 2
print(odd / N)


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


n = int(input())
p = (int(n / 2) + n % 2) / n
print(p)


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


N = float(input())
a = N - N // 2
print(a / N)


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


N = int(input().strip('\n'))
print(1 - N // 2 / N)


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


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


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


N = int(input())
X = N // 2 + N % 2
print(X / N)


user_input = int(input())
count = 0
for i in range(0, user_input + 1):
	if i % 2 != 0:
		count += 1
final_result = count / user_input
print('%.10f' % final_result)


inp = int(input())
print((inp - inp // 2) / inp)


x = int(input())
y = x // 2
z = x - y
print(z / x)


N = int(input())
print('%.10f' % ((N + 1) // 2 / N))


q = int(input())
print((q // 2 + q % 2) / q)


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


def resolve():
	n = int(input())
	if n % 2 == 1:
		print((n // 2 + 1) / n)
	else:
		print(n // 2 / n)
resolve()


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


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


a = float(input())
print((a + 1) // 2 / a)


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


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


import sys
N = int(input())
print(1 - N // 2 / N)


n = int(input())
print(sum((i % 2 == 0 for i in range(n))) / n)