It's been a year since I worked as a data scientist, and I wanted to objectively know my coding ability, so I challenged AtCorder.
Even so, I can't participate in SAS, which I usually use in my work, so I'll take a quick look at the Python grammar that I used to touch, learn how to use AtCorder, and prepare an environment where I can test with vscode.
For the time being, I wish I could finish about 3!
See the link below for the actual problem https://atcoder.jp/contests/abc160/tasks
A - Coffee The problem of determining if a given length 6 lowercase letter is similar to coffee. It seems to be a problem of instant killing from a person who has experience in competition professionals, but since the basics of extracting character strings one by one were neglected, this problem digested for 9 minutes (crying)
N = input()
if N[2] == N[3] and N[4] == N[5]:
print("Yes")
else:
print("No")
B - Golden Coins A classic problem at the beginning of At Corder dealing with currency exchange. There is no particular problem if I / O of numerical variables and four arithmetic operations can be dropped into the code. However, even with this problem, it took 10 minutes. I have too little sense of variable names (laughs)
N = int(input())
ppp = N // 500
NN = N-500*ppp
pp = NN //5
ans = 1000*ppp+5*pp
print(ans)
C - Traveling Salesman around Lake From here on, I personally have a mountain C problem For the AB problem, I should have just put the question content into the code, It's a little troublesome because I can't do that from the C problem.
This time the problem of finding the shortest path to visit all the houses standing around the pond The process itself came up immediately, but it is another matter whether it can be implemented (crying)
Wrong code submitted ⬇︎
K, N = map(int, input().split())
arr = list(map(int, input().split()))
for i in range(N-2):
sa =int(arr[i+1]-arr[i])
ssa =int(arr[i+2]-arr[i+1])
max_num = max(sa,ssa)
hasi = K-arr[N-1]+arr[0]
ans =K-(max(max_num,hasi))
print(ans)
Since I came up with a method (super basic) to loop the processing of List.append I managed to complete it within the time limit !! (80 minutes have passed at this point)
I didn't get an error, so it took a long time to debug. By the way, this problem seems to be fairly easy for a C problem. ⬇︎ Passed code
K, N = map(int, input().split())
arr = list(map(int, input().split()))
List=[]
for i in range(N-1):
sa =int(arr[i+1]-arr[i])
List.append(sa)
max_num = max(List)
hasi = K-arr[N-1]+arr[0]
PPP = (max(max_num,hasi))
ans = K-PPP
print(ans)
D - Line++
It was a problem that somehow a graph or the shortest path came out. It's not a problem that can be solved in 15 minutes remaining, so give up here By the way, it seems that a friend of a web engineer has solved it.
7167th out of 9767 people, I think it was a good fight for the debut match (laugh) However, the rating does not go up more than I expected. I have some time in Corona, so let's get serious about it for a while !!
Recommended Posts