cswork / OA打开练习工作台

Akuna CapitalOA #6

Variable Tick Rounding

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)位运算二分查找模拟/实现

A Tick describes a range with [lowerBound, upperBound) and a width. A VariableTickTable has cabinetPrice and a vector of Tick ranges. For each input price:

  • If price == cabinetPrice → no rounding needed.
  • Else if price is already tick-aligned in its range → unchanged.
  • Else round to nearest multiple of the range's width (ties → up).

Example: cabinet = 0.01, ticks [(0, 1, 0.01), (1, 5, 0.05), (5, 100, 0.10)], prices [0.01, 0.4, 1.07] → [0.01, 0.4, 1.05] (1.07 in range [1,5) rounds to nearest 0.05 step = 1.05).