题目1433:FatMouse

KiCad 7.0 + 嘉立创打样:从原理图到实物,打造你的双LLCC68 LoRa串口透传板 本文详细介绍了使用KiCad 7.0设计双LLCC68 LoRa串口透传板的完整流程,从原理图设计到嘉立创打样。重点解析了AVR+LLCC68组合的优势、双模块布局的电磁兼容设计、SPI接口配置及射频走线技巧,并提供了实测数据和常见问题解决方案,帮助开发者高效实现物联网设备的低功耗远距离通信。 阅读详情

时间限制:1 秒

内存限制:128 兆

特殊判题:否

提交:1345

解决:604

题目描述:

FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.
The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for all the JavaBeans in the room, instead, he may get J[i]* a% pounds of JavaBeans if he pays F[i]* a% pounds of cat food. Here a is a real number. Now he is assigning this homework to you: tell him the maximum amount of JavaBeans he can obtain. 

输入:

The input consists of multiple test cases. Each test case begins with a line containing two non-negative integers M and N. Then N lines follow, each contains two non-negative integers J[i] and F[i] respectively. The last test case is followed by two -1's. All integers are not greater than 1000. 

输出:

For each test case, print in a single line a real number accurate up to 3 decimal places, which is the maximum amount of JavaBeans that FatMouse can obtain. 

样例输入:

5 3

7 2

4 3

5 2

20 3

25 18

24 15

15 10

-1 -1

样例输出:

13.333

31.500

 

//Fat Mouse 
//贪心策略,每次选择性价比最高的 
   
#include<stdio.h> 
#include<iostream> 
#include<algorithm> 
using namespace std; 
const int MAX = 1005; 
   
int M;//总钱数 
int N; 
  
typedef struct House 
{ 
    int weight;//重量  
    int price;//价格  
    float wtp;//性价比  
    void calwtp(){ 
        wtp = (float)weight/price; 
    } 
}House;  
House hs[MAX]; 
  
inline bool cmp(House x,House y) 
{ 
    return x.wtp>y.wtp?1:0; 
} 
  
int
main(void) 
{ 
    while(~scanf("%d%d",&M,&N)&& M!=-1 && N!=-1) 
    { 
        float ans = 0;//最高所得重量  
        int i; 
        for(i=0;i<N;i++) 
        { 
            scanf("%d%d",&hs[i].weight,&hs[i].price); 
            hs[i].calwtp(); 
        } 
        sort(hs,hs+N,cmp); 
          
        i=0; 
        while(M && i<N) 
        { 
            if((M-hs[i].price)<0) 
            { 
                ans += hs[i].weight*(float)M/hs[i].price; 
                M = 0; 
            } 
            else
            { 
                ans += hs[i].weight; 
                M -= hs[i].price; 
            } 
            i++; 
        } 
          
        printf("%.3f\n",ans); 
    } 
    return 0; 
} 
/************************************************************** 
    Problem: 1433 
    User: ranchothu 
    Language: C++ 
    Result: Accepted 
    Time:10 ms 
    Memory:1536 kb 
****************************************************************/


 

AES攻击方法 :差分密码分析 boomerang attack飞去来器攻击 AES具有123比特的分组长度,三种可选的密钥长度(128,192,256) AES是一个迭代型密码,轮数依赖于密钥长度。如果密钥长度为128比特,则轮数为10;如果密钥长度为192比特,则轮数为12;如果密钥长度为256比特,则轮数为14; 混淆(Confusion) 混淆是为了让密钥与密文的统计信息之间的关系变得复杂,从而增加通过统计方法进行攻击的难度。混淆可以通过各种代换算法实现,如S盒、乘法(加)与异或等运算组合,为非线性部件。 扩散(Diffusion) 扩散是为了让明文的单个比特影像到 阅读详情

相关推荐

ZEMAX知识点:坐标间断面(coordinate break)

zemax知识点:坐标间断面

weixin_47638568的博客 1万+

FatMouse' Trade (九度教程第 21 题)

FatMouse' Trade (九度教程第 21 题) 时间限制:1 秒 内存限制:128 兆 特殊判题:否 1.题目描述: 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBea...

qq_37053885的博客 292

stm32最小系统_完成一个最小FOC矢量控制系统所需的基本模块和功能配置

当我们读懂 FOC 矢量控制的基本原理之后,便迫不及待的想动手尝试,去实现一个矢量控制系统,让电机先转起来,有一个直观的感受。因此,我们需要设计实现一个矢量控制的最小系统,具备矢量控制的基本功能,满足电机矢量运行的基本条件。首先,看一下矢量控制的基本架构:矢量控制架构如上图所描述,矢量控制系统包括实时电流的采集、clarke 变换、park 变换、SVPWM 、实时角度的反馈和计算以及电流环和速...

weixin_39524048的博客 1788

acm 1089 java答案_杭电ACM 第1009题 FatMouse' TradeProblem DescriptionFatMouse prepared M pounds of cat foo...

杭电ACM 第1009题 FatMouse' TradeProblem DescriptionFatMouse prepared M pounds of cat food,ready to trade with the cats guarding the warehouse containing his favorite food,JavaBean.The warehouse has N room...

weixin_28973627的博客 294

STM32F103C8T6用官方bootloader实现IAP升级操作方法

在使用STM32F103C8T6单片机IAP功能时,可以自己写bootloader程序,也可以使用官方bootloader文件。下面说一下使用官方bootloader的使用方法。 首先下载官方bootloader文件 目前使用的是这个版本,打开文件夹,选择适合自己编译器的工程。 目前使用的是keil,所以打开MDK-ARM文件夹 打开IAP工程 打开后根据自己的单片机型号,对工程进行简单的修...

HXYDJ的博客 1万+

离散数学期末考试试卷(两套)-熟悉题型

3.设集合A={a,b,c,d}上有自反关系R={,,,,},对称关系S={,,,}。6.设集合A={1,2,3},B={u,v,w},C={a,b,c},f是集合A到集合B上的映射,g是集合B到集合C上的映射,f={, , },g={},则复合函数g。5. 设集合A={a,b,c,d,e},下列选项中哪一个集合不是A的划分( )。

muse3159546973的博客 6965

HDU-1009-FatMouse' Trade(简单贪心!)

FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 57128    Accepted Submission(s): 19145 Problem Description FatMouse

保持对编程的热情! 1779

JHU ICBM DTI Atlas纤维束模板介绍

JHU ICBM DTI atlas 纤维束的定位与功能介绍

machinelearning_er的博客 6441

hdu 1009 整理下水题 贪心

Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room con

qq_29055721的博客 650

三部对接 sora-2:OpenAI 最新视频模型快速接入指南

本文介绍OpenAI最新视频生成模型Sora-2的接入方案,重点解析其Chat格式调用功能。开发者可通过在提示词中嵌入"横屏/竖屏""时长""清晰度"等要求快速生成视频。文章分三部分:1)基础准备(环境配置与API密钥获取);2)核心调用(提供Python/Java示例代码);3)结果查询与优化建议。Sora-2支持多语言调用,简化了视频生成流程,适用于短视频、广告创意等场景。

2501_93565190的博客 3442

[明道云] -基础教学1- 创建第一个工作表:从 0 到实用

明道云工作表相当于数据库表,是存储业务数据的核心组件。创建工作表主要有两种方式:1)从空白新建,通过添加字段(最多200个)、设置属性、配置表单样式;2)从Excel导入,需选择sheet、配置字段映射。创建后系统自动生成默认视图,支持多种视图形式(看板/日历等)。建议设置合适的标题字段和关联关系,初学者可在一小时内完成基础应用搭建。后续可扩展权限控制、工作流自动化等功能。

每日出拳老爷子的博客 560

HDU1009 FatMouse' Trade(贪心)

FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains Jii pounds of Ja...

UncleJokerly 822

【Ubuntu】RK3576 Linux 6.10 Ubuntu 22.04 系统中 HUSB311 Type-C 转 DP 显示输出与 Device/OTG 模式切换配置详解

本文详细介绍了在Rockchip RK3576开发板(Linux Kernel 6.10+Ubuntu 22.04)上配置HUSB311 Type-C控制器的设备树实现方案。主要内容包括:1)硬件连接与模块组成;2)设备树完整配置,涵盖Type-C供电、USB OTG/Host模式、DP显示输出等关键功能;3)软件配置步骤与常见问题排查方法。该方案实现了Type-C接口的DisplayPort AltMode显示输出、USB Device/Host模式自动切换等功能,为嵌入式系统Type-C接口开发提供参考

qq_34478161的博客 813

【九度OJ】题目1433:FatMouse 解题报告

【九度OJ】题目1433:FatMouse 解题报告标签(空格分隔): 九度OJhttp://ac.jobdu.com/problem.php?pid=1433题目描述:FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite

负雪明烛 998

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

SAP B1中文培訓教材_SDK

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

【九度】题目1433:FatMouse

题目1433:FatMouse 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3692 解决:1635 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his

菜鸟han要逆袭 ᕙ(⇀‸↼‵‵)ᕗ 347

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

21-题目1433:FatMouse

http://ac.jobdu.com/problem.php?pid=1433 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse

u011392877的博客 335

题目1433:FatMouse 九度OJ

题目1433:FatMouse 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:4875 解决:2159 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his

寻找如意的博客 288

题目1433:FatMouse 题目21

题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pou

huiyuanai222的专栏 470

九度-题目1433:FatMouse

题目1433:FatMouse 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3223 解决:1419 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his

cjt5047(peterChen)的博客 563

九度题目1433:FatMouse

原题链接:http://ac.jobdu.com/problem.php?pid=1433 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse

山之巅的专栏 776

【学习笔记】〖九度OJ〗题目1433:FatMouse

题目1433:FatMouse 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:888 解决:400 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse con...

weixin_30527551的博客 125

九度题目1433:FatMouse(贪心算法)

题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pou

牧之 1311
上一篇: 题目1049:字符串去特定字符
下一篇: 题目1434:今年暑假不AC
普通网友
博客等级 码龄17年 22粉丝 181原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值