코딩 테스트/Python

백준, Python) 2단계 2525, 2480

나무늘보섬 2025. 4. 4. 01:26

2525번

비효율의 끝판왕 

h, m = map(int, input().split())
t = int(input())
if (t + m) // 60 != 0:
    if h + ((t + m) // 60) > 23:
        if (t + m) % 60 == 0:
            print(h + ((t + m) // 60) - 24, 0)
        else:
            print(h + ((t + m) // 60) - 24, (t + m) % 60)
    else:
        if (t + m) % 60 == 0:
            print(h + ((t + m) // 60), 0)
        else:
            print(h + ((t + m) // 60), (t + m) % 60)
else:
    print(h, m + t)

 

 

 

시간 시스템을 만들고 나서 바꾼 코드

h, m = map(int, input().split())
t = int(input())

m += t
h += m // 60
m %= 60
h %= 24

print(h, m)

 

 

2480번

a,b,c = map(int,input().split())
if a== b== c:
    print(a*1000+10000)
elif a!=b==c:
    print(b*100+1000)
elif a==b!=c:
    print(a*100+1000)
elif a==c!=b:
    print(a*100+1000)
else:
    print(max(a,b,c)*100)