練習(SRMs 1 144 DIV 2 200)
SRMs 1 144 DIV2 200
どうやらDIV2の方が簡単らしい。
問題を読む為の英単語
単語 | 意味 |
---|---|
tend | 傾向がある |
represent | 代表する |
particular | 特有の、個々の |
midnight | 真夜中 |
formatted | 書式化された |
問題概要
現在0時である。
与えられる秒数から、現在からの時刻を解答せよ。
ただし、フォーマットは"H:M:S"とし、Hは時数、Mは分数、Sは秒数を表す。
例示
input: 5436
output:"1:30:36"
input: 0
output:"0:0:0"
解答
class Time { public static string whatTime(int seconds) { int h, m, s; string ret; h = seconds / 3600; seconds %= 3600; m = seconds / 60; seconds %= 60; s = seconds; ret = h.ToString () + ":" + m.ToString () + ":" + s.ToString (); return ret; } }