Last time 14th day
#14 Today is B.
** Thoughts ** ABC081-B ABC081-B divides $ A_i $ until it is divisible by 2 when it is an even number. If it is an odd number, it will be quit immediately.
n = int(input())
a = list(map(int,input().split()))
counter = []
for i in range(n):
count = 0
if a[i] % 2 == 0:
while a[i] % 2 == 0:
a[i] //= 2
count += 1
counter.append(count)
else:
print(0)
quit()
print(min(counter))
ABC087-B ABC087-B has a triple loop with a stop of thinking.
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
price = 500 * i + 100 * j + 50 * k
if price == x:
ans += 1
print(ans)
ABC083-B ABC083-B has N of about $ 10 ^ 4 $, so I'm checking all N's. $ 1 \ leq i \ leq n $ i is set to str, totaled for each digit, and divided by if.
n, a, b = map(int,input().split())
ans = 0
for i in range(n+1):
i = str(i)
k = 0
for j in range(len(i)):
k += int(i[j])
if k <= b and k >= a:
ans += int(i)
print(ans)
ABC088-B ABC088-B works best with each other, so take the largest card left. So, I sort and add up one by one. You don't have to divide it by player, but you can make a difference for each player.
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
alice = 0
bob = 0
for i in range(n):
if i % 2 == 0:
alice += a[i]
else:
bob += a[i]
print(alice-bob)
ABC085-B ABC085-B cannot put rice cakes of the same size, so they are sorted with no duplication.
n = int(input())
d = {int(input()) for _ in range(n)}
d = list(d)
d.sort()
print(len(d))
About B can be solved. From tomorrow's C is the production! see you
Recommended Posts