CCPC 2016 Final 【solve 6 of 12】
A.The Third Cup is Free【简单贪心】题意:有n杯咖啡,每杯有对应的价格。每三杯可免费其中最便宜的一杯。求购买n杯咖啡的最小花费。 做法:从大到小排序,每三杯累计前两杯的费用。 代码:#include <bits/stdc++.h>using namespace std;int a[100100];inline int rd(){ int x = 0,f = 1
原创
2017-10-20 23:29:56 ·
2539 阅读 ·
0 评论