尺取法解题步骤: head=tail=0; while(1){ ①while(当前区间不满足约束&&tail<n) {tail后移;更新区间信息;} ②if(当前区间不满足约束) break; ③更新ans; ④head后移;更新区间信息;} 相关文章: