BOJ_13300

Seungju HwangΒ·2020λ…„ 8μ›” 17일
0

algorithm

λͺ©λ‘ 보기
1/14
post-thumbnail

μ•Œκ³ λ¦¬μ¦˜λ„ μž˜ν•΄μ•Ό λ˜‘λ˜‘ν•œ κ°œλ°œμžκ°€ 될 수 있겠죠?
κ·Έλž˜μ„œ μ‘°κΈˆμ”© μ‰¬μš΄κ²ƒλΆ€ν„° ν’€μ–΄λ³΄λ €κ΅¬μš”γ…Žγ…Ž;
μ˜€λŠ˜μ€ ν‚Ήλ‹΅λ₯  50퍼이상 λ¬Έμ œλ“€μ΄λΌμ„œ μ‰½κ²Œ ν’€μ—ˆλŠ”λ° λ‹€μŒλΆ€ν„°κ°€ κ±±μ •μ΄λ„€μ˜€..πŸ€”πŸ€”

13300_λ°©λ°°μ •

N = int(input())
input_list = list(map(int, input().split()))


result = []
for i, n in enumerate(input_list):
    result.insert(i-n, i+1)

for i in result:
    print(i,end=' ')

2605_μ€„μ„Έμš°κΈ°

N, K =map(int,input().split())
result = 0
cnt = [0]*12
#i 0 2 4 6 8 10  // 1 3 5 7 9 11
#n 1 2 3 4 5 6      1 2 3 4 5 6
# 2*(n-1)           2*n-1


for _ in range(N):
    s, y = map(int, input().split())
    if s:
    	i = (2*y)-1
        cnt[i] += 1
        if cnt[i] == K:
            cnt[i] = 0
            result += 1
    else:
    	i = 2*(y-1)
        cnt[i] += 1
        if cnt[i] == K:
            cnt[i] = 0
            result += 1

for n in cnt:
    if n!=0:
        result += 1


print(result)
profile
κΈ°λ‘ν•˜λŠ” μŠ΅κ΄€μ€ μ‰½κ²Œ λ¬΄λ„ˆμ§€μ§€ μ•Šμ•„μš”.

0개의 λŒ“κΈ€