Skip to content

Instantly share code, notes, and snippets.

View evjeny's full-sized avatar

Evgeny Kanafin evjeny

View GitHub Profile
@evjeny
evjeny / Task4
Created October 10, 2017 14:26
Task4.py
def r(a,b):
al = a[-2:]
bl = b[-2:]
if len(a)>=2 and len(b) >=2:
return al==bl
return False
f = int(input())
arr = []
for i in range(4):
@evjeny
evjeny / Task5.py
Created October 10, 2017 14:37
Task 5
def r(a,b):
al = a[-2:]
bl = b[-2:]
if len(a)>=2 and len(b) >=2:
return al==bl
return False
def way(a,b,c,d):
if r(a,b) and r(c,d):
@evjeny
evjeny / Task2.py
Created October 10, 2017 14:53
Task 2
def gip(msk,adrs):
ma = [int(i) for i in msk.split(".")]
da = [int(i) for i in adrs.split(".")]
res = ""
for j in range(4):
c = ma[j]&da[j]
if j!=3:
res += str(c) + "."
else:
res += str(c)
@evjeny
evjeny / DoesntWord7.py
Created October 11, 2017 01:57
FoolishTask7
def dist(ax,ay,bx,by):
if ax==bx:
return abs(ay-by)
elif ay==by:
return abs(ax-bx)
else:
return ((ax-bx)**2+(ay-by)**2)**0.5
def ka(ax,ay,bx,by):
@evjeny
evjeny / Task7.py
Created October 11, 2017 11:14
Task7
def dist(ax,ay,bx,by):
return ((ax-bx)**2+(ay-by)**2)**0.5
def abc(ax,ay,bx,by):
b = ay-by
a = bx-ax
c = -a*ay-b*bx;
return [a,b,c]
@evjeny
evjeny / Task1.py
Created October 19, 2017 14:02
Task 1
s = input()
lts = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if s[0] in lts and s[1:4].isdigit() and s[4] in lts and s[5] in lts:
print("Yes")
else:
print("No")
@evjeny
evjeny / Task6.py
Created October 19, 2017 15:50
Task 6
n, m, v, u = [int(i) for i in input().split()]
v -= 1
u -= 1
arr = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
a, b = [int(i) - 1 for i in input().split()]
arr[a][b] = 1
arr[b][a] = 1
k = int(input())
@evjeny
evjeny / Task3.py
Created October 19, 2017 16:28
Task 3
input()
a = int(input())
i = 1
while True:
b = a^i
if b!=a:
print(i,b)
break
i += 1
@evjeny
evjeny / Task4.py
Created October 19, 2017 16:35
Task 4
n = int(input())
a = [int(i) for i in input().split()]
c = 0
if n==1: c = a[0]
else: c = a[0]^a[1]
i = 1
while True:
b = c^i
if b!=c:
print(i,b)
@evjeny
evjeny / Task5.py
Created October 19, 2017 16:45
Task 5
n = int(input())
a = [int(i) for i in input().split()]
c = 0
for i in a:
c = c ^ i
i = 1
while True:
d = c^i
if d not in a and i not in a: