MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon/Python

#2525 ์˜ค๋ธ์‹œ๊ณ„ - python

HYEJU01 2024. 4. 8. 22:16

 

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

hT=h+int(sm/60) 
mT=m+int(sm%60)

if (mT>=60):
    hT+=1
    m= mT-60
    h=hT

    if(hT>23):
        hT-=24
        h=hT
else:
    m = mT
    h = hT
    
    if(hT>23):
        hT-=24
        h=hT

print(h,m)

 

 

์Šค์Šค๋กœ ํ’€์–ด๋ณธ ๊ฒฐ๊ณผ... ใ…œ ๋งŽ์ด ๋ณต์žกํ•˜์ง€๋งŒ ํ†ต๊ณผํ–ˆ๋‹ค.

์‹œ๊ฐ„ ๊ณ„์‚ฐ์‹œ %24 ํ™œ์šฉ์„ ์ƒ๊ฐ ๋ชปํ•ด์„œ ๊ธธ์–ด์ง„ ๊ฒƒ ๊ฐ™๋‹ค.

ํ•˜๋‹จ์—” ๋” ์ข‹์€ ์ฝ”๋”ฉ์„ ๊ฐ€์ง€๊ณ  ์™”๋‹ค.


 

 

if b+c < 60:
   print(a, b+c)
else:
   print((a+(b+c)//60)%24, (b+c)%60)

 

b+c 60๋ณด๋‹ค ์ž‘์œผ๋ฉด

๋ฐ”๋กœ ์ถœ๋ ฅํ•˜๊ณ 

 

ํฐ ๊ฒฝ์šฐ์—๋Š”

(b+c)//60 ๋‚˜๋ˆˆ ๋ชซ = ์‹œ๊ฐ„๊ณผ a ๋ฅผ ๋”ํ•œ๋’ค

24 ๋ฅผ ๋„˜์ง€ ์•Š๊ฒŒ  %24์˜ ๋‚˜๋จธ์ง€๊ฐ’์„ ์ถœ๋ ฅํ•˜๋„๋ก ํ•œ๋‹ค. 

๋ถ„์€ (b+c)์—์„œ %๋‚˜๋จธ์ง€ ๊ฐ’๋งŒ ์ถ”์ถœ