solutions(contest): 2065A, 2065B, 2065D
This commit is contained in:
parent
387cbcb94c
commit
7a02ae5ba6
3 changed files with 51 additions and 0 deletions
8
solutions/python/2065A.py
Normal file
8
solutions/python/2065A.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
t = int(input())
|
||||
|
||||
for _ in range(t):
|
||||
w = input()
|
||||
|
||||
w = w[0:len(w)-2]
|
||||
|
||||
print(w+"i")
|
19
solutions/python/2065B.py
Normal file
19
solutions/python/2065B.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
t = int(input())
|
||||
|
||||
for _ in range(t):
|
||||
w = list(input())
|
||||
|
||||
adjacent = False
|
||||
|
||||
for i in range(1, len(w)):
|
||||
if w[i] == w[i-1]:
|
||||
adjacent = True
|
||||
|
||||
if len(w) <= 1:
|
||||
break
|
||||
|
||||
if not adjacent:
|
||||
print(len(w))
|
||||
continue
|
||||
|
||||
print("1")
|
24
solutions/python/2065D.py
Normal file
24
solutions/python/2065D.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
t = int(input())
|
||||
|
||||
for _ in range(t):
|
||||
n, m = map(int, input().split(' '))
|
||||
|
||||
a = []
|
||||
|
||||
for _ in range(n):
|
||||
a.append(list(map(int, input().split(' '))))
|
||||
|
||||
a = sorted(a, key=lambda x: sum(x))[::-1]
|
||||
|
||||
concat = []
|
||||
|
||||
for i in a:
|
||||
for j in i:
|
||||
concat.append(j)
|
||||
|
||||
total = 0
|
||||
|
||||
for idx, i in enumerate(concat):
|
||||
total += (n*m-idx)*i
|
||||
|
||||
print(total)
|
Loading…
Reference in a new issue