Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions homework_5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#task1------------------------------------------------------------
"""
���� ������ �������������� �����: x1, y1, x2, y2. �������� ������� distance(x1, y1, x2, y2),
����������� ���������� ����� ������ (x1,y1) � (x2,y2). �������� ������ �������������� ����� � �������� ��������� ������ ���� �������.
"""
from math import sqrt
def read(n):
return float(input())
def distance(x1, y1, x2, y2):
return sqrt((x2-x1)**2+(y2-y1)**2)
n=0
x1=read(n)
y1=read(n)
x2=read(n)
y2=read(n)
print (distance(x1, y1, x2, y2))
#-----------------------------------------------------------------


#task2------------------------------------------------------------
"""
���� �������������� ������������� ����� a � ����e ����� n.

��������� an. ������� �������� � ���� ������� power(a, n).

����������� �������� ���������� � ������� ������������ ������.
"""
def power(a, n):
q=a
res=1
for i in range(1,abs(n)+1):
res*=a
if n>0:
return res
else:
return 1/res
a=float(input())
n=int(input())
print(power(a, n))
#-----------------------------------------------------------------


#task3------------------------------------------------------------
"""
���� �������������� ������������� ����� a � ����� ��������������� ����� n. ��������� an �� ��������� �����,
���������� � ������� ����� ** � ������� math.pow(), � ��������� ������������ ����������� an=a*an-1.
"""
def power(a, n):
if n == 0:
return 1
else:
return a * power(a,n-1)
a=float(input())
n=int(input())
print (power (a, n))
#-----------------------------------------------------------------


#task4------------------------------------------------------------
"""
�������� ������� fib(n), ������� �� ������� ������ ���������������� n ���������� n-e ����� ���������.
� ���� ������ ������ ������������ ����� � ����������� ��������.
"""
def fib(n):
if n == 1 or n == 2:
return 1
else:
return (fib(n-1) + fib(n-2))
n = int(input())
print(fib(n))
#-----------------------------------------------------------------
84 changes: 84 additions & 0 deletions students/km63/Kolcov_Dmytro/homework_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#task1------------------------------------------------------------
"""
�������� ��������, ��� ������ ��� ����� � ����� �� ����. ����� ����� ���������� ������� � �������� �����.
"""
a = int(input())
b = int(input())
c = int(input())
print(a + b + c)
#-----------------------------------------------------------------


#task2------------------------------------------------------------
"""
�������� ��������, ��� ������ ������� ���� ������ ������������ ���������� �� �������� ���� �����. ���������� ������� ������� ������ � ������� ������.

"""
b = int(input())
h = int(input())
print(1/2*b*h)
#-----------------------------------------------------------------


#task3------------------------------------------------------------
"""
N �������� �������� K ����� � ���������� �� �� ����� ������. ��������� ������ ���������� � ������. ������ ����� ������ ����� �������? ������ ����� ���������� � ������?
"""
n = int(input())
k = int(input())
print(k // n)
print(k % n)
#-----------------------------------------------------------------


#task4------------------------------------------------------------
"""
����� ����� N - ������� ������, ����������� ���� ������. ������ ����� � ������ ���� ���������� �������� ��������, ���� �� ���� ����� 00:00?
"""
a = int(input())
b=a//60
b=b%24
c=a%60
print(b,c)
#-----------------------------------------------------------------


#task5------------------------------------------------------------
"""
�������� ��������, ��� ��� �����������, �������� ����� "Hello", ��'� ����������� � ���� ������ ���� �����. ��������� �Hello, Mike!�

"""
a = str(input())
print("Hello, "+a+"!")
#-----------------------------------------------------------------


#task6------------------------------------------------------------
"""
�������� ��������, ��� ����� ���� ����� � ����� ���� ��������� � �������� �������� �� ��������:
"""
a = int(input())
b=(a+1)
c=(a-1)
a=str(a)
b=str(b)
c=str(c)
print("The next number for the number "+a+" is "+b+".")
print("The previous number for the number "+a+" is "+c+".")

#-----------------------------------------------------------------


#task7------------------------------------------------------------
"""
����� ������� ���������� ��� ��� ����� ����� �� ������ �� ����� �����. � ������� ���� ��������� ���������� ����� ��� �����,
� ����������, �� �� ����� ������ ���� ����� �� ����� ���� �����. ��� ��������� ������� ����� ��������� ��������?
"""
a = int(input())
b = int(input())
c = int(input())
d=(a+1)//2
e=(b+1)//2
f=(c+1)//2
print(d+e+f)
#-----------------------------------------------------------------
204 changes: 204 additions & 0 deletions students/km63/Kolcov_Dmytro/homework_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
#task1------------------------------------------------------------
"""
���� ��� ����� �����. ������� �������� � ���.
"""
a = int(input())
b = int(input())
if (a>b):
print (b)
else:
print(a)
#-----------------------------------------------------------------


#task2------------------------------------------------------------
"""
������� ��������� �������sign(x), �� ����������� ��������� �����:
sign(x) = 1, if x > 0,
sign(x) = -1, if x < 0,
sign(x) = 0, if x = 0..

"""
x = int(input())
if x>0:
print(1)
if x==0:
print(0)
if x<0:
print(-1)
#-----------------------------------------------------------------


#task3------------------------------------------------------------
"""
���� ��� ����� �����. ������� �������� � ���.
"""
a = int(input())
b = int(input())
c = int(input())
if a<b<=c:
print (a)
if a<c<b:
print (a)
if b<a<=c:
print (b)
if b<c<a:
print (b)
if c<a<=b:
print (c)
if c<b<a:
print (c)
#-----------------------------------------------------------------


#task4------------------------------------------------------------
"""
���� ���� �����, �� ������� ��. ���������, �� � �������� �� ����������. ���� ���, �� ������� ����������� "LEAP", � ������ ������� � "�OMMON".
"""
a = int(input())
if (((a%4)==0) and ((a%100)!=0)) or ((a%400)==0):
print ('LEAP')
else:
print ('COMMON')
#-----------------------------------------------------------------


#task5------------------------------------------------------------
"""
���� ��� ����� �����. ��������, ������ � ��� ��������� ���� ������. �������� ������� �������� ���� � �����: 3 (���� �� ����� �������),
2 (���� ��� � ��� ��������� ���� ������, � ���� �����������) ��� 0 (���� �� ����� ����).

"""
a = int(input())
b = int(input())
c = int(input())
if a==b==c:
print ('3')
if a==b!=c or b==c!=a or c==a!=b:
print ('2')
if a!=b and b!=c and c!=a:
print ('0')
#-----------------------------------------------------------------


#task6------------------------------------------------------------
"""
������ ���� ����������� �� ���������� ��� �� ��������. ���� ���������� ���� ����� ������ �����. ���������, �� ���� ���� ������� � ����� ������ � ����� �� ���� ���.
���������� ������� ������ ����� ����� �� 1 �� 8, ����� � ���� ������� ����� ����� �� ��������� ������. ����� ��� ����� - ��� ����� ������, ������� ��� ����� � ��� �����.
�������� �� ������� "YES", ���� ���� ���� �������� ����������, ��� "NO" � ������ �������.
"""
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a==c or b==d:
print('YES')
else:
print('NO')
#-----------------------------------------------------------------


#task7------------------------------------------------------------
"""
���� ���������� ���� ����� ������ �����. ���������, �� ���������� ���� �������. ���������� ������� ������ ����� ����� �� 1 �� 8,
����� � ���� ������� ����� ����� �� ��������� ������. ����� ��� ����� - ��� ����� ������, ������� ��� ����� � ��� �����.
�������� �� ������� "YES", ���� ���� ���������, ��� "NO" � ������ �������.
"""
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if ((a+b)%2)==((c+d)%2):
print('YES')
else:
print('NO')
#-----------------------------------------------------------------


#task8------------------------------------------------------------
"""
������� ������ ����������� �� ����������, �� �������� ��� �� ������� �� ����-��� ������ �������. ���� ���������� ���� ����� ������ �����. ���������,
�� ���� ������ ������� � ����� ������ � ����� �� ���� ���. ���������� ������� ������ ����� ����� �� 1 �� 8, ����� � ���� ������� ����� ����� �� ��������� ������.
����� ��� ����� - ��� ����� ������, ������� ��� ����� � ��� �����. �������� �� ������� "YES", ���� ��� ��������, ��� "NO" � ������ �������.

"""
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if ((a==c) and ((b-d)==1 or (d-b)==1)) or (b==d and ((a-c)==1 or (c-a)==1)) or (((a-c)==1) and ((b-d)==1 or (d-b)==1)) or (((c-a)==1) and ((b-d)==1 or (d-b)==1)):
print ('YES')
else:
print ('NO')
#-----------------------------------------------------------------


#task9------------------------------------------------------------
"""
������� ���� �������� �� ������� �� ����-��� ������� �����. ���� ���������� ���� ����� ������ �����. ���������, �� ���� ���� ������� � ����� ������ � ����� �� ���� ���.
���������� ������� ������ ����� ����� �� 1 �� 8, ����� � ���� ������� ����� ����� �� ��������� ������. ����� ��� ����� - ��� ����� ������, ������� ��� ����� � ��� �����.
�������� �� ������� "YES", ���� ��� ��������, ��� "NO" � ������ �������.
"""
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if ((a-c)==(b-d) or (a-c)==(d-b)) or ((c-a)==(b-d) or (a-c)==(d-b)):
print ('YES')
else:
print ('NO')
#-----------------------------------------------------------------


#task10------------------------------------------------------------
"""
������ �������� �������� �� ����������, �� �������� ��� �� ������� �� ����-��� ������� �����. ���� ���������� ���� ����� ������ �����. ���������,
�� ���� �������� ������� � ����� ������ � ����� �� ���� ���. ���������� ������� ������ ����� ����� �� 1 �� 8, ����� � ���� ������� ����� ����� �� ��������� ������.
����� ��� ����� - ��� ����� ������, ������� ��� ����� � ��� �����. �������� �� ������� "YES", ���� ��� ��������, ��� "NO" � ������ �������.
"""
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if ((a-c)==(b-d) or (a-c)==(d-b)) or ((c-a)==(b-d) or (a-c)==(d-b)) or (a==c or b==d):
print ('YES')
else:
print ('NO')
#-----------------------------------------------------------------


#task11------------------------------------------------------------
"""
������� ��� �������� �� ����� L. ³� ���� ����������� �� �� ������� �� ���������� � ���� ������� �� �������� ��� �� �� ������� �� �������� � ���� �� ����������.
���� ���������� ���� ����� ������ �����. ���������, �� ���� ��� ������� � ����� ������ � ����� �� ���� ���. ���������� ������� ������ ����� ����� �� 1 �� 8,
����� � ���� ������� ����� ����� �� ��������� ������. ����� ��� ����� - ��� ����� ������, ������� ��� ����� � ��� �����.
�������� �� ������� "YES", ���� ��� ��������, ��� "NO" � ������ �������.

"""
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if (((b-d)==2) or ((d-b)==2)) and (((a-c)==1)or((c-a)==1)) or (((a-c)==2) or ((c-a)==2)) and (((b-d)==1)or((d-b)==1)):
print ('YES')
else:
print('NO')
#-----------------------------------------------------------------


#task12------------------------------------------------------------
"""
������� �� ����� ������������, ���������� �� n?m �����. ������� ���� ���� ��������� �� �� ������� ����� �� ���������� ��� �� ��������,
��� ����� ������ ����� ���� ������. ���������, �� ����� �������� ������� �� ���� ���� ����� �����, ��� ���� � ������ ������ ����� k �����.
�������� �� ������� "YES", ���� ������� ����� �������, ��� "NO" � ������ �������.
"""
n = int(input())
m = int(input())
k = int(input())
a=n*m
b=a-k
if b>0 and (b%n==0 or b%m==0):
print ('YES')
else:
print ('NO')
#-----------------------------------------------------------------
Loading