B1
Code:
from math import sqrt
x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
d= sqrt((x2-x1)**2 + (y2-y1)**2)
print(d)
B2
Code:
from math import sqrt
a = int(input())
b = int(input())
c = int(input())
d = a+b+c
p = d/2.0
s = sqrt(p*(p-a)*(p-b)*(p-c))
print(d)
print(s)
B3
Code:
from math import sqrt
def dodai(xa,ya,xb,yb):
return sqrt(((xb-xa)**2)+((yb-ya)**2))
x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
x3 = int(input())
y3 = int(input())
dab=dodai(x1, y1, x2, y2)
dbc=dodai(x2, y2, x3, y3)
dac=dodai(x1, y1, x3, y3)
print("{:.3}".format(dab))
print("{:.3}".format(dbc))
print("{:.3}".format(dac))
B4
Code:
a=int(input())
b=int(input())
x=(a-2)*(b-2)
y=a*b-x
print(x)
print(y)
B5
Code:
n=int(input())
s=n*(n+1)//2
print(s)