AC is only A problem. Immediately after the end, I was able to AC the B problem.
A - Don't be late I wrote it according to the problem. I remember the math class.
D,T,S = map(int,input().split())
if D / S <= T:
print("Yes")
else:
print("No")
B - Substring I was able to AC immediately after the end.
S = input()
T = input()
sl = len(S)
tl = len(T)
ans = tl
for i in range(sl - tl + 1):
flag = 0
tmp = 0
for j in range(tl):
if S[j + i] == T[j]:
tmp += 1
ans = min(ans,tl - tmp)
print(ans)
C - Sum of product of pairs I was able to AC by referring to the cumulative sum of the explanations.
N = int(input())
A = list(map(int,input().split()))
s = [0]
for i in range(N):
s.append(s[i] + A[i])
ans = 0
for i in range(N):
ans += A[i] * (s[N] - s[i + 1])
print(ans % (10 ** 9 + 7))
This time it was not good. Solve past questions and practice.
Recommended Posts