[백준] 1193, 2869, 10250 (파이썬)

Colacan·2022년 1월 19일
1

[백준]

목록 보기
3/43

오늘은 수학적인 패턴파악의 중요성을 느꼈다. 더 많이 풀어봐야할 것 같다.

백준 1193번 분수찾기

x = int(input())
line = 0
while True:
    line += 1
    x -= line
    if x<=0:
        x += line
        line += 1
        break
if line%2==0:
    print(str(line-x)+'/'+str(x))
else:
    print(str(x)+'/'+str(line-x))
# line   1       2           3               4
#      (1/1),(1/2,2/1),(3/1,2/2,1/3),(1/4,2/3,3/2,4/1)
# 규칙성을 좀 더 생각해보자

백준 2869번 달팽이는 올라가고 싶다

import math
A,B,V = map(int,input().split())
time = (V-A)/(A-B)
print(math.ceil(time)+1)
#시간초과에 유의하자

백준 10250번 ACM 호텔

T = int(input())
for i in range(T):
    H,W,N = map(int,input().split()) #호텔의 층 수, 각 층의 방 수, 몇 번째 손님
    if N % H == 0:
        floor = H
        Ho = N//H
    else:
        floor = N%H
        Ho = N//H + 1
    print(floor*100+Ho)
profile
For DE, DA / There is no royal road to learning

0개의 댓글