ZJU-PAT 1070. Mooncake (25)

从零到一:Silvaco中跨导曲线的自动化脚本实现 本文详细介绍了如何使用Python脚本在Silvaco中实现跨导曲线(gm曲线)的自动化分析,包括数据加载、跨导计算和结果可视化。通过自动化处理Id-Vg曲线,显著提升半导体器件工程师的工作效率,特别适用于工艺优化和DOE分析。文章还提供了批量处理和关键参数提取的高级技巧,帮助工程师快速掌握Silvaco脚本开发。 阅读详情

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
贪心按单价从高到低排序
#pragma warning (disable:4786)
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;

int n,m;
struct Pro
{
    double W;
    double Y;
    double V;
};
Pro TT[1005];

bool cmp(Pro a,Pro b)
{
    return a.V>b.V;
}

int main()
{
    while(cin>>n>>m)
    {
        for(int i=0;i<n;i++) cin>>TT[i].W;
        for(int i=0;i<n;i++)
        {
            cin>>TT[i].Y;
            TT[i].V=TT[i].Y/TT[i].W;
        }
        sort(TT,TT+n,cmp);

        double ans=0;
        for(int i=0;i<n;i++)
        {
            if(m<=0) break;
            if(m>TT[i].W)
            {
                ans+=TT[i].Y;
                m-=TT[i].W;
            }
            else
            {
                ans+=TT[i].V*m;
                m-=m;
            }
        }
        cout<<fixed<<setprecision(2)<<ans<<endl;
    }
    return 0;
}


Vins-Fusion 外参camera-imu 标定 Vins-Fusion是一种基于优化的多传感器状态估计器,一大特色是支持实时camera-imu外参校准(相机和IMU之间的旋转)。Vins-Fusion 外参camera-imu校准是利用两帧间计算相机位姿和imu预积分得到位姿,构建最小二乘问题,并通过SVD求解camera-imu外参旋转矩阵。 阅读详情

相关推荐

JasperReport制作行内容合并的表格

效果图: 实现思路一: 交叉表 另一个思路: 普通表格 缺点:无法实现内容 垂直居中显示 准备工作 一、数据准备 DROP TABLE IF EXISTS `address_item_sex_value`; CREATE TABLE `address_item_sex_value` ( `id` int(11) NOT NULL AUTO_INCREM...

weixin_34148456的博客 2468

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的专栏 5452

微带T型一分四功分器HFSS仿真与实物制作教程

本文介绍了使用HFSS软件进行微带T型一分四功分器的仿真与使用国产立创EDA软件将HFSS仿真文件转为PCB可加工文件的方法

qq_52127343的博客 2万+

AtCoder Beginner Contest 355 A~F

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

Code_Shark的博客 1353

ESD 防护深度解析:模型、等级、系统设计与防护策略

本文系统阐述了静电放电(ESD)防护的核心技术体系。首先对比分析了HBM(人体模型)和CDM(充电设备模型)两种基础ESD模型的物理特性、测试标准及分级要求,指出相同电压下CDM的破坏性是HBM的15-20倍。其次详细解析了IEC61000-4-2系统级ESD标准,包括接触/空气放电测试方法及判定等级。重点提出了系统级防护的三层架构:空间隔离(≥10mm间距)、电气隔离(地平面分割)和TVS管选型(响应时间<1ns),并对比了MOV、SCR等防护器件特性。针对不同应用场景(消费电子、工业控制等)给出了差异化

bother3000的博客 1882

基于openwrt平台搭建局域网技术验证之四

1、测试目的 验证l2tp客户端模式的可行性。 提供vpn-l2tp模式的客户端功能。 2、参考资料 参考链接1:https://www.lucktang.com/191.html 3、测试过程 测试过程需要用到的资源: 路由器俩个 win7系统电脑俩台 ③ 交换机一个 ④ 网线三根 测试组网如下图所示: 组网说明: R0公司路由器 S1 交换机 R1 路由器1 R2 路由器2 PC1 个人电脑1 PC2 个人电脑2 (R0) lan口接(S1)...

caofengtao1314的专栏 1960

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

C++/WinRT入门指南:现代Windows原生开发的核心技术

Windows运行时(WinRT)是微软为现代Windows应用开发设计的一套跨语言API框架,它基于COM技术原理构建,提供了统一的二进制接口标准。这项技术的核心价值在于让开发者能够以原生性能调用系统级功能,同时保持跨语言兼容性。在工程实践中,C++/WinRT作为官方推荐的C++语言投影,通过标准C++语法封装WinRT API,显著降低了开发复杂度。特别是在异步编程场景中,结合C++20协程特性,能够大幅提升代码可读性和维护性。对于需要高性能图形处理、系统集成或跨平台兼容的桌面应用开发,掌握C++/W

weixin_33910191的博客 1198

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万+

运行后选择GDB/LLDB出现这样的窗口:launch: program ‘输入程序名称,例如 D:\Desktop\新建文件夹\a.exe‘ does not exist...如何解决?

🏆本文收录于 《全栈 Bug 调优(实战版)》 专栏。专栏聚焦真实项目中的各类疑难 Bug,从成因剖析 → 排查路径 → 解决方案 → 预防优化全链路拆解,形成一套可复用、可沉淀的实战知识体系。无论你是初入职场的开发者,还是负责复杂项目的资深工程师,都可以在这里构建一套属于自己的「问题诊断与性能调优」方法论,助你稳步进阶、放大技术价值 。

**My Coding Family** 1129

在 SAP BTP ABAP 环境中构建多租户应用:从架构到实战

ABAP多租户应用架构解析 本文详细介绍了SAP BTP中ABAP环境的多租户应用架构,重点阐述了其核心组件及协作机制。在云原生SaaS模式下,多租户架构使多个客户能共享同一套ABAP平台,同时保持数据和配置隔离。架构包含三层:平台与子账户层、多租户应用与平台服务层(含Approuter、ABAP Solution service、XSUAA等核心组件)、ABAP系统与租户层。文章深入分析了各组件功能,包括Approuter的路由机制、ABAP Solution service的自动资源调度、XSUAA的安

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

PAT甲级1070(月饼)

1070 Mooncake (25 point(s)) 题目原文   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 acco...

云胡的博客 229

手把手教你学PCIE--系统内存管理:GART(Graphics Address Remapping Table)的典型用途详解

GART(图形地址重映射表)是GPU的核心组件,主要用于地址映射转换。其典型用途分为物理模式和虚拟模式两类:在物理模式下,GART将GPU虚拟地址映射到分散的物理内存,支持DMA连续访问非连续内存块,适用于GPU渲染纹理采样和AI推理数据搬运等场景;在虚拟模式下,GART配合IOMMU实现多级映射,将GPU虚拟地址转换为虚拟机物理地址再映射到宿主机物理地址,确保多租户隔离,应用于云服务器GPU共享和容器化AI训练等虚拟化环境。两种模式分别优化了高性能计算场景和虚拟化场景的需求。

MHD0815的博客 367

PAT 1070. Mooncake

题目:http://pat.zju.edu.cn/contests/pat-a-practise/1070 题解: 代码: #include #include #include #include #include #include #include using namespace std; struct moonCake { double n; double price; }

Ted's 游乐园 1177

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

1070. Mooncake

题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1070 /* * 贪心问题 * 坑:数量为double。这样符合实际问题,但是题目给的示例及题目信息尾 * 表明为double。 */ #include #include #include using namespace std; struct Mooncake { dou

Sunshine 874

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

PAT甲级题目1070 Mooncake

题目大意: 卖月饼获取最大利润。 代码: #include <iostream> #include <cstdio> #include <algorithm> using namespace std; struct Mooncake { double num; double total, price; }cake[1010]; bool cmp(Mooncake a, Mooncake b) { return a.price > b.p

weixin_43801993的博客 170

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

【PAT_Python解】1070 结绳

多学习其他大佬的AC代码!

新时代先锋的博客 577

PAT——1070 结绳

给定一段一段的绳子,你需要把它们串成一条绳。每次串连的时候,是把两段绳子对折,再如下图所示套接在一起。这样得到的绳子又被当成是另一段绳子,可以再次对折去跟另一段绳子串连。每次串连后,原来两段绳子的长度就会减半。给定 N 段绳子的长度,你需要找出它们能串成的绳子的最大长度。

Jamaple的博客 221

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)解题报告

#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

信道者 499

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

1070 Mooncake (25分)

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

ttu___的博客 320

PAT1070 结绳 (25 分)(C语言)

题目 给定一段一段的绳子,你需要把它们串成一条绳。每次串连的时候,是把两段绳子对折,再如下图所示套接在一起。这样得到的绳子又被当成是另一段绳子,可以再次对折去跟另一段绳子串连。每次串连后,原来两段绳子的长度就会减半。 给定 N 段绳子的长度,你需要找出它们能串成的绳子的最大长度。 输入格式: 每个输入包含 1 个测试用例。每个测试用例第 1 行给出正整数 N (2≤N≤10^​4​​);第 2 ...

Sqssq的博客 515

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

Eric的博客 361

甲级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的博客 852

PAT甲级考试知识点总结和一些看法

PAT甲级考试知识点总结和一些看法

woyaottk的博客 6577
上一篇: ZJU-PAT 1065. A+B and C (64bit) (20)
下一篇: ZJU-PAT 1010. Radix (25)
Matrix_Reloaded
博客等级 码龄14年 18粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值