python-algorithm

백준 26340 Fold the Paper Nicely

무적김두칠 2022. 12. 22. 16:24

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
반응형