#54745: 關於 lower_bound( )


s310387@gapp.ylsh.ilc.edu.tw (林畇丞)


如果是因為偷懶使用lower_bound 的話,要對目標進行向上取整 ( a/b -> (a+b-1)/b )

所以 auto it = lower_bound( pre.begin( )+l, pre.begin( )+r+1, ( a * pre[r] + b * pre[l-1] + ( a + b ) -1) / ( a + b ) )