본문 바로가기
python-algorithm

백준 26340 Fold the Paper Nicely

by 무적김두칠 2022. 12. 22.

https://www.acmicpc.net/problem/26340

 

26340번: Fold the Paper Nicely

Dr. Orooji has a daily calendar (365 pages) on his desk. Every morning, he tears off one page and, as he is reading the notes on the next page, he folds (out of habit) the sheet in his hand. Dr. O noticed that he always folds the sheet (a rectangular paper

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def sol(num1, num2, cnt):
    for _ in range(cnt):
        if num1>num2:
            num1 = int(num1/2)
        else:
            num2 = int(num2 / 2)
    return max(num1,num2),min(num1,num2)
 
if __name__ == '__main__':
    n = int(input())
    for _ in range(n):
        num1, num2, cnt = map(int, input().split())
        print('Data set: %d %d %d'%(num1,num2,cnt))
        print(*sol(num1, num2, cnt))
        if _ !=n-1:
            print()
            
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 26531 Simple Sum  (0) 2022.12.22
백준 6825 Body Mass Index  (0) 2022.12.22
백준 6887 Squares  (0) 2022.12.22
백준 5357 Dedupe  (0) 2022.12.22
백준 26350 Good Coin Denomination  (0) 2022.12.22

댓글