結果
| 問題 |
No.1236 長針と短針
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-08-18 04:36:30 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 403 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-10-11 04:32:52 |
| 合計ジャッジ時間 | 3,438 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
A, B = gets.split.map(&:to_i)
T = 60 * 60 * 24
def f(t)
t * Rational(360, 60 * 60)
end
def g(t)
t * Rational(360, 60 * 60 * 12)
end
def t1(m, s)
(m * 60 + s) % 3600
end
def t2(h, m, s)
((h * 60 * 60) + m * 60 + s) % (60 * 60 * 12)
end
0.upto(7200) do |i|
a = f(t1(B, i))
b = g(t2(A, B, i))
c = f(t1(B, i + 1))
d = g(t2(A, B, i))
if a <= b && c >= d
puts i
exit
end
end
siman