浙江大学PAT_甲级_1070. Mooncake (25)

雷达截面积建模仿真(RCS) 在目标侧,其形状、材料、尺寸(相对于雷达波长)和相对于雷达观察方向的方向等特征都会影响雷达看到的RCS。严格的数学处理超出了讨论的范围,但入射波和目标之间的相互作用可以定性描述。对于给定的散射方向,可以积分求和物体表面电流的振幅相位,当电流同相时,会出现较大的回波幅度。随着目标方向和雷达视角随时间变化,电流振幅和相位会发生变化,形成看似随机的峰值和零点的散射模式,出现“相长”和“相消”干涉。除了雷达到目标的距离外,雷达截面(RCS)是RRE(雷达距离方程)中唯一与目标相关的参数,因此不在雷达设计者的。 阅读详情

题目链接:点击打开链接

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 kinds of the mooncakes, together with the maximum total demand of the market, you are supposed to tell the maximum profit that can be made.

Note: partial inventory storage can be taken. The sample shows the following situation: given three kinds of mooncakes with inventory amounts being 180, 150, and 100 thousand tons, and the prices being 7.5, 7.2, and 4.5 billion yuans. If the market demand can be at most 200 thousand tons, the best we can do is to sell 150 thousand tons of the second kind of mooncake, and 50 thousand tons of the third kind. Hence the total profit is 7.2 + 4.5/2 = 9.45 (billion yuans).

Input Specification:

Each input file contains one test case. For each case, the first line contains 2 positive integers N (<=1000), the number of different kinds of mooncakes, and D (<=500 thousand tons), the maximum total demand of the market. Then the second line gives the positive inventory amounts (in thousand tons), and the third line gives the positive prices (in billion yuans) of N kinds of mooncakes. All the numbers in a line are separated by a space.

Output Specification:

For each test case, print the maximum profit (in billion yuans) in one line, accurate up to 2 decimal places.

Sample Input:
3 200
180 150 100
7.5 7.2 4.5
Sample Output:
9.45
这题在乙级考试里出现过, 点击打开链接.

我的C++代码:

#include<iostream>
#include<algorithm>
using namespace std;
struct mooncake
{
	double reserve;//库存量
	double all_price;//总价
	double unit_price;//单价
};
bool compare(mooncake a, mooncake b)
{
	return a.unit_price > b.unit_price;
}
int main()
{
	int i=0,n, requirement;
	double income = 0.0;
	mooncake cake[1001];
	cin >> n >> requirement;
	for (i = 0; i < n; i++)
	{
		cin >> cake[i].reserve;
	}
	for (i = 0; i < n; i++)
	{
		cin >> cake[i].all_price;
		cake[i].unit_price = cake[i].all_price / cake[i].reserve;
	}
	sort(cake, cake + n, compare);
	i = 0;
	while (requirement >0&&i<n)
	{
		if (requirement >= cake[i].reserve)
		{
			income = income + cake[i].reserve *cake[i].unit_price;
			requirement = requirement - cake[i].reserve;
			i++;
		}
		else
		{
			income = income + requirement*cake[i].unit_price;
			requirement = 0;
		}
	}
	printf("%.2f", income);
	//system("pause");
	return 0;
}


控制障碍函数(Control Barrier Function,CBF) 二、示例 使用一个经典简单的示例讲解CBF的推导 阅读详情

相关推荐

多模态变体—ALIGN:高效的图像-文本学习

ALIGN 论文介绍了该模型的关键技术。无人工标注数据:使用互联网数据进行训练,不依赖人工清洗的数据集。高效的对比学习策略:采用大规模图像-文本配对数据,通过对比学习优化嵌入空间。支持零样本(zero-shot)学习:可以在没有专门训练的情况下执行多种任务,如分类、检索等。可扩展性强:ALIGN 采用高效的 CNN 或 Transformer 作为编码器,适用于大规模计算。

Azperk的博客 1234

C++编程

转载自:http://blog.csdn.net/abcjennifer/article/details/19423987 PAT 1070 基础贪心 Mooncake (25) 时间限制 100 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Mooncake is a Chinese ba

ldrmcml的专栏 5454

Halcon和C#联合编程实现硬币识别(个人入门练习)

本人为机器视觉入门小白,自己突发奇想 1.图片数据来源和分析 2.HALCON实现 3.C#搭建界面框架 4.C#中嵌入HALCON代码,即联合编程 5.导出.exe文件,运行以及Debug 目标是这样的,在图片中识别出每种类型的硬币数量,然后计算出总钱数。先上结果,再细说过程。 C#界面和识别结果: 1.图片数据来源和分析 图片大小及格式均统一,拍摄的时候已经尽可能的去除了背景噪点,所以图像处理的要求并不很高(重点在于思路)。硬币区分原理本人代码采用直径范围来判断(也可以半径或区域面积,HALCON算子

Demobird的博客 3637

AtCoder Beginner Contest 355 A~F

已知有三个嫌疑人,有两个证人,每个证人可以指出其中一个嫌疑人不是罪犯,如果可以排除两个嫌疑人来确定犯人,输出犯人的身份,如果无法确定,输出"-1"。

Code_Shark的博客 1355

别再说Fortran过时了!手把手教你用VS Code + gfortran搭建现代开发环境(2024版)

本文打破Fortran过时的刻板印象,详细介绍如何利用VS Code和gfortran搭建现代开发环境。从编译器安装、VS Code插件配置到项目结构标准化,提供完整的2024版跨平台解决方案,并展示Fortran 2023标准的协程、并行计算等现代特性,助力科学计算与高性能开发。

weixin_42629815的博客 248

从OpenClaw到Hermes Agent:AI Agent实战部署与自动化工作流构建

AI Agent(智能体)作为大语言模型(LLM)的能力延伸,其核心原理在于通过工具调用(Tool Calling)与环境交互,使模型从“对话”走向“执行”。这一技术价值在于将自然语言指令转化为具体操作,实现业务流程自动化,从而提升开发与运维效率。在应用场景上,AI Agent广泛适用于自动化运维、智能客服、数据报告生成等重复性任务处理。本文聚焦于两大热门开源框架OpenClaw与Hermes Agent,深入探讨其部署配置、技能扩展及实战联调。通过结合OpenClaw的模块化扩展能力与Hermes Age

weixin_34122810的博客 513

c++编程思想-第2章 对象的创建与使用-2

#include #include #include #include using namespace std; int main() {     //cout     // 1.     string word;     ifstream in("HarryPotter.txt");     while (in >> word)//每次读取输入的一

Jake2549794390的博客 1万+

国科大作业考试资料《人工智能原理与算法》2024新编-第二次作业整理

1、对于下列活动,分别给出任务环境的PEAS描述, 并按2.3.2节列出的性质进行分析: 3、为图2.2中描述的吸尘器世界实现一个可以进行性能度量的环境模拟器。你的实现是必须是模块化的,以使传感器、执行器和环境特征(大小、形状、灰尘放置等)便于修改。 4、实现上述题目真空吸尘器环境中的简单反射Agent。用所有可能的初始灰尘分布和Agent位置,运行环境模拟器和Agent。记录Agent在每种情况下的性能评分和总体平均评分。

MatsumotoChrikk 1198

cake

此文参考网上的代码。。。刚开始有些没想通。。。组要还是需要自己动手切一下蛋糕最好 网上连接:http://blog.csdn.net/ilovexiaohao/article/details/8590583 杭电题地址:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=2§ionid=1&problemid=4

l1905的专栏 760

KEPServerEX 6 之 EX 6.11.718.0 发布说明

KEPServerEX 6.11.718.0 发布说明

-雲飛兄-博客 2896

如何在 SAP BTP 上通过 CDS view 快速创建 Fiori Elements 应用

本文基于 SAP Business Technology Platform 的 ABAP 编程环境进行的开发。 使用 ABAP Development Tool 登录 SAP BTP ABAP 编程环境,新建一个 package,命名为 Z_JERRY_CDS. 右键选中该 package,创建一个新的 Consumption view. 该视图是一个消费视图,它基于业务对象 (BO) 视图 /DMO/I_TRAVEL_U,提供了独立于消费层的给定数据模型。 它包含在其上运行的应用程序所需的所有核心信息。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 2034

1070.Mooncake (25)

1070.Mooncake (25)pat-al-10702017-02-09 典型的贪心 乙级里也有这题 遇到段错误,可以考虑是不是数组越界,看看用到数组的地方是不是要对下标的判断更谨慎一点。坑见注释 /** * pat-al-1070 * 2017-02-09 * Cpp version * Author: fengLian_s */ #include<stdio.h> #includ

一剑钦安 505

动态时间规整(Dynamic Time Warping,DTW):让时间序列分析不再枯燥和代码全分析

动态时间规整(DTW)是一种用于比较时间序列相似性的算法,特别适用于处理长度不同或时间轴不对齐的序列。本文介绍了DTW的核心概念,包括其通过非线性对齐解决时间扭曲问题的能力,以及在语音识别、金融分析等领域的应用。通过Python代码示例,演示了如何计算两个模拟时间序列的DTW距离,并可视化最优对齐路径。结果显示,DTW能够有效捕捉序列间的相似模式,即使它们在时间轴上存在偏移或伸缩。该算法通过最小化累积距离来评估相似性,得分越低表明序列间相似度越高。

此星光明博客 178

【PAT甲级A1070】Mooncake (25分)(c++)

1070 Mooncake (25分) 作者:CHEN, Yue 单位:浙江大学 代码长度限制:16 KB 时间限制:400 ms 内存限制:64 MB 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

小庄同学的博客 138

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

PAT甲级 1070 Mooncake

浙江大学PAT题目解答内容. Contribute to ZouJiu1/PAT development by creating an account on GitHub.GitHub - ZouJiu1/PAT: 浙江大学PAT题目解答内容。

邹九的个人博客 194

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

1070. Mooncake (25)解题报告

#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cstdlib> #include <cfloat> #include <algorithm> using namespace std;struct mooncake { double inventory, price, perprice; };bool comp(moon

信道者 500

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

1070. Mooncake 解析

对单价排序 然后一个个算就好啦 #include #include #include #define MAX 1010 using namespace std; int n, ton; struct Node{ float ton; float prise; float avg; }; Node MoonCake[MAX]; bool cmp(Node n1, Node n2

sheepyWYY的博客 587

1070 Mooncake (25分)

给定月饼的数量和价格和所需的数量,求最大利润。 计算单位数量的价格排序,最后计算的时候不用这个(浮点计算可能会有问题,改成按比例计算之后牛客网的用例全都通过了) pat里的第二个用例应该是月饼数量带小数,把amount也改成浮点就过了。 #include <stdio.h> #include <algorithm> #include <math.h> usin...

ttu___的博客 320

1070. Mooncake (25)

题目链接:http://www.patest.cn/contests/pat-a-practise/1070 题目: Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found

Apie_CZX的专栏 1838

Mooncake (排序+贪心)

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

weixin_30443747的博客 259

甲级PAT 1070 Mooncake (排序+贪心)

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

Joyceyang_999的博客 853

PAT乙级1070

1070. 结绳(25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 给定一段一段的绳子,你需要把它们串成一条绳。每次串连的时候,是把两段绳子对折,再如下图所示套接在一起。这样得到的绳

湛蓝的天空 884

PAT甲级刷题记录——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 ...

一只奋斗中的本科生 401

ldr命令

一直以来,关于ldr的命令的理解,总是很模糊,网上有很多讲解的文章,讲的不全面,有时互相矛盾。得到一个结论就是:看资料还是尽量看最权威、最源头的资料。 1.ldr汇编指令 参考资料: ARM体系结构与编程(第二版) 杜春雷 2.2.2 字及无符号字节的Load/Store 指令的寻址方式:讲的概括性 3.1.6 Load/Store内存访问指令:具体的例子 ldr汇编指令 2...

YitengKaji的博客 4232

PAT (Advanced) 1070. Mooncake (25)

#include #include #include #include using namespace std; const int MAX = 1010; struct Mooncake { double inventory; double price; double cp; // cost performance bool operator < (const Moonc

hale1007的专栏 769

PAT 甲级 1070 Mooncake (25分) 贪心

PAT 甲级 1070 Mooncake (25分) 贪心

星辰不问 215
上一篇: 浙江大学PAT_甲级_1083. List Grades (25)
下一篇: C++记录程序运行时间
pythontojava
博客等级 码龄12年 84粉丝 140原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址