본문 바로가기
알고리즘/백준

[백준]230128-30 문제풀이

by stubborngastropod 2023. 1. 30.
728x90

1065. 한수

n = int(input())
count = 0
for i in range(1, n+1):
    if len(str(i)) < 3:
        count += 1
    elif len(str(i)) > 2:
        str_list = []
        for j in range(1, len(str(i))):
            str_list.append(int(str(i)[j])-int(str(i)[j-1]))
        if len(set(str_list)) == 1:
            count += 1

print(count)

7568. 덩치

N = int(input())
wh_list = []

for i in range(N):
    a = list(map(int, input().split()))
    wh_list.append(a)

for i in wh_list:
    count = 0
    for j in wh_list:
        if i[0] < j[0] and i[1] < j[1]:
            count += 1
    print(count + 1, end = ' ')

회식의 여파로 머리를 못굴리겠어서 어려운 문제는 다 광탈하고 겨우겨우 푼 문제들... 그래도 적당히 쉬운 문제들은 대략 짧게짧게 적을 수 있게 됐다

 

15235. Olympiad Pizza

n = int(input())
conlist = list(map(int, input().split()))
timelist = []
count = 0
for i in range(n):
    timelist.append(0)
success = 0
while sum(conlist) > 0:
    for i in range(n):
        if conlist[i] != 0:
            count += 1
            conlist[i] -= 1
            if conlist[i] == 0:
                timelist[i] = count
        else:
            pass

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

스택, 큐, 그리디 등 실3~4 수준 문제를 풀어보려고 하루종일 노력했으나 어떤 문제도 풀지 못하고 결국 실5 큐 하나 풀어냈다... 이게 큐 푸는 방식으로 푼건지도 모르겠다... 머리가 굳은건지 문제가 안풀려서 미치겠다. 머리 식히고 낼부터 다시 버닝해봐야지

728x90

'알고리즘 > 백준' 카테고리의 다른 글

[백준]230202 문제풀이  (2) 2023.02.02
[백준]230131 문제풀이  (0) 2023.01.31
[백준]230127 문제풀이  (0) 2023.01.30
[백준]230126 문제풀이  (0) 2023.01.26
[백준]230125 문제풀이  (0) 2023.01.25

댓글