March 28, 2020. I participated in AtCoder for the first time.
Participated contest AtCoder Beginner Contest 160 Solve 3 questions A to C and time out with D. I was disappointed that I couldn't do it more than I expected As a review, I will put together the code that I wish I had done quickly.
temp=input()
A=temp.split(" ")
A=[int(i) for i in A]
Let the list A of the entered numbers be
N=5
L=list()
for i in range(N):
L.append(i)
print(L)
Before that···
import random
random.seed(0)
L=[random.randint(0, 100) for i in range(5)]
print(L)
#Maximum value
print(max(L))
#index
maxind=L.index(max(L))
print(maxind)
#5 rows x 4 columns
D = [[0] * 4 for i in [1] * 5]
print(D)
#Substitute 1 in the 3rd row and 4th column
D[2][3]=1
print(D)
Let's complete Problem D, which was in the process of being implemented
・ Undirected graph ・ BFS (breadth-first search) Let's find out about the keywords of.
I tried to make the program that I had made halfway to the end, but it became quite complicated, so I'm sorry. I will study algorithms obediently. ↓ ↓ For studying graph structure, I made a graph class myself and drew it. Create your own graph structure class and its drawing with python