結果
問題 |
No.3099 Parentheses Decomposition
|
ユーザー |
![]() |
提出日時 | 2025-06-12 13:15:13 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 955 bytes |
コンパイル時間 | 492 ms |
コンパイル使用メモリ | 82,712 KB |
実行使用メモリ | 67,548 KB |
最終ジャッジ日時 | 2025-06-12 13:17:44 |
合計ジャッジ時間 | 2,957 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 20 |
ソースコード
def calculate_night_hours(s1, e1): overlap = 0.0 # Check overlap with 0-6 hours start = max(s1, 0.0) end = min(e1, 6.0) if start < end: overlap += end - start # Check overlap with 18-24 hours start = max(s1, 18.0) end = min(e1, 24.0) if start < end: overlap += end - start return overlap T, S, D = map(int, input().split()) travel_time = D / S days = int(travel_time // 24) remainder = travel_time % 24 total_night = days * 12 start = T end = start + remainder if end > 24: # Split into two intervals part1_start = start part1_end = 24.0 part2_start = 0.0 part2_end = end - 24.0 overlap1 = calculate_night_hours(part1_start, part1_end) overlap2 = calculate_night_hours(part2_start, part2_end) total_remainder = overlap1 + overlap2 else: total_remainder = calculate_night_hours(start, end) total_night += total_remainder print("{0:.15f}".format(total_night))