long time no see. It turned brown, so I skipped it a little. Today we will solve it as ABC036.
** Thoughts ** Round up with ceil and divide.
import math
a, b = map(int,input().split())
print(math.ceil(b/a))
** Thoughts ** Just swap the vertical and horizontal with for.
n = int(input())
s = [list(input()) for _ in range(n)]
d = []
for i in range(n):
c = []
for j in range(n):
c.append(s[j][i])
c = c[::-1]
d.append(c)
ans = ''
for i in range(n):
s = ''.join(d[i])
print(s)
** Thoughts ** Commentary AC. It was easy with dict. I did not know. Delete the duplicate elements of $ a $ with set, sort them, and put them in the dict in order.
n = int(input())
a = [int(input()) for _ in range(n)]
s = sorted(list(set(a))) #set
dic = {}
for i, e in enumerate(s): #You can minimize the number by using enumerate.
dic[e] = i
for i in a:
print(dic[i])
I am not familiar with data structures, so I will study. Aim green! Good night yet.
Recommended Posts