N = input()

bring = []
result = 0

for i in N:
    p = int(i)
    
    if p not in bring:
        if p == 9:
            if 6 in bring:
                bring.remove(6)
                continue
        elif p == 6:
            if 9 in bring:
                bring.remove(9)
                continue
                
        for j in range(10):
            bring.append(j)
        result += 1
        bring.remove(p)
        
    else:
        bring.remove(p)
        
print(result)
N = int(input())
n_vote = []

for i in range(N):
    n_vote.append(int(input()))
    
cand = n_vote[1:len(n_vote)]
dasom = n_vote[0]
    
if(N == 1):
    print(0)

else:
    num = 0
    cand = sorted(cand, reverse = True)
    while(cand[0] >= dasom):
        dasom += 1
        cand[0] -= 1
        num += 1
        cand = sorted(cand, reverse = True)

    print(num)

'프로그래밍 > 알고리즘' 카테고리의 다른 글

[Python] 백준 1475번 : 방 번호  (0) 2020.04.13
[Python] 백준 2309번 : 일곱난쟁이  (0) 2020.02.18
[Python] 백준 2217번 : 로프  (0) 2020.02.18
a = []
for i in range(9):
    a.append(int(input()))
sum = 0
for i in a: sum += i

not_nanzang = sum - 100
a.sort()
i = 0
while(not_nanzang > a[i] + a[8]):
    i += 1

for i in range(i,8):
    for j in range(i+1,9):
        if(a[i] + a[j] == not_nanzang):
            num1 = a[i]
            num2 = a[j]
            break;
a.remove(num1)
a.remove(num2)

for i in a:
    print(i)

 

k = int(input())
max_lope = []
a = 0
for i in range(k):
    a = int(input())
    max_lope.append(a)
    
max_lope.sort()

max_weight = 0
for i in range(k):
    m = max_lope[i] * (k - i)
    if(m > max_weight):
        max_weight = m

print(max_weight)

+ Recent posts