首页 > TAG信息列表 > A1070
A1070 Mooncake (25 分)
一、参考代码 #include<cstdio> #include<algorithm> #include<iostream> using namespace std; struct P{ double need;//库存 double value;//总价 double s_mon;//单价 }; bool cmp(P a, P b){ return a.s_mon > b.s_mon; } int main(){ iPAT_A1070#Mooncake
Source: PAT A1070 Mooncake (25 分) Description: Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region's culture. NowA1070
给出总价和需求量,求最大收益。 思路:求单价最高的,排序。 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 struct mooncake{ 5 double store;//存货 6 double sell;//总价 7 double price;//单价 8 }cake[1010]; 9 bool cmp(mooncake