백준10250번

리오·2021년 3월 27일
0
#백준10250번
#몫과 나머지 연산자 이용

def reco(h,w,n):
    if n%h==0:
        room=(h*100)+((n//h))
    else:
        room=((n%h)*100)+((n//h)+1)
    return room

cases=int(input())  
lst=[]  
for i in range(0,cases):
    h,w,n=map(int,input().split())
    lst.append(reco(h,w,n))
for i in range(0,cases):
    print(lst.pop(0))

#백준10250번 다른풀이
#좌표 움직이는 방식

def reco(h,w,n):
    x=1
    y=1
    for i in range(0,n-1):
        if y<h:y=y+1
        else :
            y=1
            x=x+1
    return 100*y+x
#-------------------------이 밑으론 첫번째풀이와 동일
cases=int(input())  
lst=[]  
for i in range(0,cases):
    h,w,n=map(int,input().split())
    lst.append(reco(h,w,n))
for i in range(0,cases):
    print(lst.pop(0))
profile
현실에 안주하지 않는

0개의 댓글

Powered by GraphCDN, the GraphQL CDN