首页 > TAG信息列表 > Mooncake

神坑!该用double用成int就会出错!-1070 Mooncake (25 分)

1070 Mooncake (25 分) 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. Now given the inventory amounts a

PAT B1020 月饼 解题记录

很简单的贪心算法,不过一开始做的时候还是有好多情况没有考虑到 思路很简单,读取输入,然后计算各种月饼单价,按单价对月饼进行排序,优先选择单价高对月饼。 下面说说一开始犯的几个错误。(我是用java写的) 1:一开始提交,全是答案错误,于是检查题目,发现要求保留两位小数。于是使用Deci

Alice's mooncake shop

题目大意: 一个月饼店开m个小时(24小时营业),只在整点做月饼,做月饼的能力非常强。现在只需要考虑成本的问题。给m个cost值,cost[i]表示第i个小时做1个月饼的代价。 再给n个时间,从2000年1月1日0时开始计算。表示订单的截止时间。当然为了节约成本,可以提前趁成本不高的时候做月饼。但是月

PTA乙级 (1020 月饼 (25分))

1020 月饼 (25分) https://pintia.cn/problem-sets/994805260223102976/problems/994805301562163200 #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <algorithm> #include <

贪心

  贪心: #include <cstdion> #include <algorithm> using namespace std; struct mooncake{ double store; //库存量 double sell; //总售价 double price; //单价 }cake[1010]; bool cmp(mooncake a,mooncake b){ //按单价从高到低排序 return a.pri

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(){ i

PAT B1020 月饼

#include<iostream>#include<algorithm>using namespace std;struct mooncake{ double store; double sell; double price;} cake[1010];bool cmp(mooncake a,mooncake b){ return a.price>b.price;}int main(){ int n; double D; cin>>n>>D; for(

1070 Mooncake (25 分)

1070 Mooncake (25 分) 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. Now given the inventory amounts a

【1070】Mooncake (25 分)

#include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<map> #include<vector> #include<queue> using namespace std; //key:策略-总是选择单价最

1070 Mooncake (25 分) 贪心

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. Now given the inventory amounts and the prices of all ki

1070 Mooncake (25 分) 贪⼼算法

1070 Mooncake (25 分) 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. Now given the inventory amounts a

PAT_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. Now

1020 月饼 (25 分)

月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。 注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有 3 种月饼,其库存量分别为 18、15、10 万

1070 Mooncake (25 分)

1070 Mooncake (25 分) 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. Now given the inventory amount

A1070

给出总价和需求量,求最大收益。 思路:求单价最高的,排序。 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