Skip to content

Commit a250116

Browse files
authored
Add files via upload
1 parent 0e37424 commit a250116

27 files changed

+407
-0
lines changed

AntonandDanik.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
n = int(input())
2+
a = input()
3+
4+
Acount = 0
5+
Dcount = 0
6+
7+
for i in range(n):
8+
if a[i] == 'A':
9+
Acount += 1
10+
elif a[i] == 'D':
11+
Dcount += 1
12+
13+
if Acount > Dcount:
14+
print("Anton")
15+
16+
elif Dcount > Acount:
17+
print("Danik")
18+
19+
elif Acount == Dcount:
20+
print("Friendship")

BearandBigbrother.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
x, y = map(int, input().split())
2+
3+
i = 0
4+
5+
while x <= y:
6+
x *= 3
7+
y *= 2
8+
9+
i += 1
10+
11+
print(i)

Bit++.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
n = int(input())
2+
3+
x = 0
4+
5+
for i in range(n):
6+
a = input() #string
7+
8+
if (a[1] == '+'):
9+
x += 1
10+
elif (a[1] == '-'):
11+
x -= 1
12+
13+
print(x)
14+
15+
16+
17+
# ++X, X++ a[0]
18+
# --X, X--

BoyorGirl.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
a = input()
2+
3+
i = 0
4+
5+
while i <= len(a)-1:
6+
if i == len(a)-1:
7+
break
8+
9+
elif a[i] in a[i+1:]:
10+
a = a[:i]+a[i+1:]
11+
i = i - 1
12+
13+
i += 1
14+
15+
if len(a) % 2 == 0:
16+
print("CHAT WITH HER!")
17+
18+
else:
19+
print("IGNORE HIM!")

DominoPiling.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
a, b = input().split()
2+
a, b = int(a), int(b)
3+
4+
AreaofBoard = a*b
5+
6+
AreaofDomino = 2
7+
8+
if (AreaofBoard % 2 != 0):
9+
10+
NDomino = (AreaofBoard-1)/2
11+
12+
else:
13+
NDomino = AreaofBoard/2
14+
15+
print(int(NDomino))

Elephant.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
n = int(input())
2+
3+
i = 0
4+
count = 0
5+
6+
while i < n:
7+
if n-i >= 5:
8+
i += 5
9+
count += 1
10+
elif n-i >= 4:
11+
i += 4
12+
count += 1
13+
elif n-i >= 3:
14+
i += 3
15+
count += 1
16+
elif n-i >= 2:
17+
i += 2
18+
count += 1
19+
elif n-i >= 1:
20+
i += 1
21+
count += 1
22+
23+
print(count)

Queueattheschool.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
e, n = map(int, input().split())
2+
q = list(input())
3+
4+
count = 0
5+
i = 0
6+
7+
while i < len(q):
8+
if q[i] == "B":
9+
if q[i+1] == "G":
10+
q[i+1],q[i] = q[i],q[i+1]
11+
count += 1
12+
i += 2
13+
# if q[i+2] != "G":
14+
# i += 2
15+
# else:
16+
# i += 1
17+
if count == n+1:
18+
break
19+
i = i + 1
20+
21+
o = ''.join(map(str, q))
22+
print(o)

SoldierandBananas.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
x, m, n = map(int, input().split())
2+
3+
Tc = 0
4+
5+
for i in range(1,n+1):
6+
Tc += x*i
7+
8+
B = Tc-m
9+
if B < 0:
10+
B = 0
11+
print(B)

StonesOnTheTable.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
n = input()
2+
a = input()
3+
count = 0
4+
5+
6+
for i in range(len(a)-1):
7+
if a[i+1] == a[i]:
8+
count += 1
9+
10+
print(count)

Team.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
n = int(input())
2+
3+
o = 0
4+
5+
for i in range(n):
6+
a,b,c = map(int,input().split())
7+
8+
if (a+b+c >= 2):
9+
o += 1
10+
11+
print(o)

Translation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
a = input()
2+
b = input()
3+
c = ''
4+
5+
for i in range(len(a)-1,-1,-1):
6+
c += a[i]
7+
8+
if c == b:
9+
print('YES')
10+
11+
else:
12+
print('NO')

Wordcapitalization.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
s = input()
2+
print(s[0].upper()+s[1:])

beautifulMatrix.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
l1 = []
2+
for i in range(5):
3+
a = list(map(int, input().split()))
4+
l1.append(a)
5+
for j in range(5):
6+
if l1[i][j] == 1:
7+
o = abs(2-i)+abs(2-j)
8+
print(o)

deleteme.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
inp = input()
2+
a = ['a','b','c','d']
3+
count = 5
4+
for i in range(0,len(a)):
5+
if count == 1:
6+
break
7+
for j in range(0,len(inp)):
8+
if(a[i] == inp[j]):
9+
count = 1
10+
break
11+
else:
12+
count = 0
13+
if count == 1:
14+
print("YES")
15+
16+
elif count == 0:
17+
print("NO")

deleteme2.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
a = ['wub']
2+
3+
inp = input()
4+
5+
a = inp[1::]
6+
print(a)
7+
8+
9+
#while True:
10+
# if (a[i] == inp[::]):
11+
# inp[]

deleteme3.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
n = int(input())
2+
s = ''
3+
for i in range(n):
4+
a = input()
5+
s+=a
6+
7+
print(s)
8+
9+
str1 = "hello world I'm a software"
10+
print(str1.split())
11+
print(str1.split("l"))
12+
13+
def fahrenheit(T):
14+
return ((float(9)/5)*T + 32)
15+
16+
temp = [0, 22.5, 40,100]
17+
F_temps = list(map(fahrenheit, temp))
18+
print(F_temps)

helpfulmaths.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
a = input()
2+
c = ''
3+
l = []
4+
for i in a:
5+
if i != '+':
6+
c += i
7+
8+
c = sorted(c)
9+
10+
for i in c:
11+
l.append(i)
12+
l.append('+')
13+
14+
l.pop()
15+
c = ''.join(l)
16+
print(c)
17+
18+

kefa.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
n = int(input())
2+
3+
a = list(map(int, input().split()))
4+
5+
count = 1
6+
temp = 0
7+
maximum = 0
8+
9+
for i in range(1,n):
10+
if (a[i-1] <= a[i]):
11+
count += 1
12+
temp = count
13+
else:
14+
if (count > maximum):
15+
maximum = count
16+
count = 1
17+
18+
if (n==1):
19+
print(1)
20+
21+
elif maximum > temp:
22+
print(maximum)
23+
24+
else:
25+
print(temp)

kelfa.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
n = int(input())
2+
a = list(map(int, input().split()))
3+
a.append(-10)
4+
5+
count = 1
6+
max = 0
7+
8+
for i in range(n):
9+
if a[i] <= a[i+1]:
10+
count+=1
11+
else:
12+
if count > max:
13+
max = count
14+
count = 1
15+
16+
print(a)

nearlyluckynumber.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
a = input()
2+
3+
count = 0
4+
5+
6+
for i in range(len(a)):
7+
if a[i] == '4' or a[i] == '7':
8+
count += 1
9+
10+
11+
if count == 4 or count == 7:
12+
print('YES')
13+
14+
else:
15+
print('NO')

nextRound.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
n, k = input().split()
2+
3+
n, k= int(n),int(k)
4+
5+
a = list(map(int, input().split()))
6+
7+
kth = a[k-1]
8+
9+
counter = 0
10+
11+
for i in range(n):
12+
if (a[i] >= kth and a[i] != 0):
13+
counter += 1
14+
else:
15+
break
16+
17+
print(counter)

petya_and_strings.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
a = input().lower()
2+
b = input().lower()
3+
4+
max_index = len(a)-1
5+
i,j = 0,0
6+
7+
while a[i] == b[j] and i != max_index:
8+
i += 1
9+
j += 1
10+
11+
if a[i] > b[j]:
12+
print(1)
13+
14+
elif a[i] < b[j]:
15+
print(-1)
16+
17+
else:
18+
print(0)
19+
20+
21+
22+
23+

trams.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
n = int(input())
2+
no = 0
3+
max = 0
4+
for i in range(n):
5+
out, inp = map(int, input().split())
6+
no -= out
7+
no += inp
8+
if no > max:
9+
max = no
10+
11+
print(max)
12+

0 commit comments

Comments
 (0)