結果

問題 No.296 n度寝
ユーザー Hirotaka Hanada
提出日時 2016-01-28 20:17:36
言語 Ruby
(3.4.1)
結果
AC  
実行時間 176 ms / 1,000 ms
コード長 289 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-07 02:43:20
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

def getTime(n, h, m, t)

th = t / 60
tm = t % 60

  for i in 1..n-1
  h = h + th
  m = m + tm
    if m > 59 then
      h = h + 1
      m = m % 60
    end
    if h > 23 then
      h = h % 24
    end
  end
puts h
puts m

end

N,H,M,T = gets.split(" ")
getTime(N.to_i, H.to_i, M.to_i, T.to_i)
0