It was three completes from A to C.
** Thoughts ** Just compare
s = input()
t = input()
n = len(t)
if s == t[:n-1]:
    print('Yes')
else:
    print('No')
** Thoughts ** 2WA () without noticing the deadly typo
a, b, c, k = map(int,input().split())
if a >= k:  #all k a
    print(k)
elif a + b >= k: #If you take c, it will decrease, so take it from b
    print(a)
else:
    n = k - (a + b)
    ans = a + -1 * n
    print(ans)
** Thoughts ** I was impatient with 2WA at B, so I was late to submit it. Withstands a typical bit full search, N is small enough.
n, m, x = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(n)]
costs = []
for i in range(2 ** n):
    flag = True
    cost = 0
    algos = [0] * m
    op = [False] * n
    for j in range(n):
        if ((i >> j) & 1):
            op[n - j - 1] = True
    #print(op)
    for j in range(n):
        if op[j]:
            for k, u in enumerate(ca[j][1:]):
                algos[k] += u
            cost += ca[j][0]
    for j in algos:
        if j < x:
            flag = False
    if flag:
        costs.append(cost)
if len(costs) == 0:
    print(-1)
else:
    print(min(costs))
** Thoughts ** I found a loop and sought the remainder, but I couldn't pass it in about 8 cases and WA.
The last three ABCs are WAs in A and B each time, so I have to calm down and solve it. See you again, good night.
Recommended Posts