p8837专题

P8837 [传智杯 #3 决赛] 商店(贪心加双指针)

题目背景 思路解析:很经典的贪心问题,把物品按照从便宜到贵的顺序排好序,然后按照富贵程度排人,直接暴力会tle所以这里采用双指针. #include<iostream>#include<algorithm>#include<cstring>#include<cmath>#include<string>using namespace std;int n, m, res;int qi