Daily AtCoder # 14 in Python

Introduction

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))

Summary

About B can be solved. From tomorrow's C is the production! see you

Recommended Posts

Daily AtCoder # 36 in Python
Daily AtCoder # 2 in Python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 53 in Python
Daily AtCoder # 33 in Python
Daily AtCoder # 7 in Python
Daily AtCoder # 37 in Python
Daily AtCoder # 8 in Python
Daily AtCoder # 21 in Python
Daily AtCoder # 38 in Python
Daily AtCoder # 11 in Python
Daily AtCoder # 15 in Python
Daily AtCoder # 47 in Python
Daily AtCoder # 13 in Python
Daily AtCoder # 45 in Python
Daily AtCoder # 30 in Python
Daily AtCoder # 10 in Python
Daily AtCoder # 28 in Python
Daily AtCoder # 20 in Python
Daily AtCoder # 19 in Python
Daily AtCoder # 52 in Python
Daily AtCoder # 3 in Python
Daily AtCoder # 14 in Python
Daily AtCoder # 50 in Python
Daily AtCoder # 26 in Python
Daily AtCoder # 4 in Python
Daily AtCoder # 43 in Python
Daily AtCoder # 29 in Python
Daily AtCoder # 22 in Python
Daily AtCoder # 49 in Python
Daily AtCoder # 27 in Python
Daily AtCoder # 1 in Python
Daily AtCoder # 25 in Python
Daily AtCoder # 16 in Python
Daily AtCoder # 12 in Python
Daily AtCoder # 48 in Python
Daily AtCoder # 23 in Python
Daily AtCoder # 34 in Python
Daily AtCoder # 51 in Python
Daily AtCoder # 31 in Python
Daily AtCoder # 46 in Python
Daily AtCoder # 35 in Python
Daily AtCoder # 9 in Python
Daily AtCoder # 44 in Python
Daily AtCoder # 41 in Python
Atcoder ABC164 A-C in Python
atCoder 173 Python
Python Input Note in AtCoder
Atcoder ABC167 A-D in Python
Atcoder ABC165 A-D in Python
Atcoder ABC166 A-E in Python
Atcoder ABC169 A-E in Python
AtCoder ABC177 A-D in python
Solve Atcoder ABC169 A-D in Python
[Python] Basic knowledge used in AtCoder
Quadtree in Python --2
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python