結果

問題 No.296 n度寝
コンテスト
ユーザー Hirotaka Hanada
提出日時 2016-01-28 20:17:36
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 289 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 172 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2026-03-28 16:53:41
合計ジャッジ時間 2,204 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #
raw source code

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