Codeforces 919A (Supermarket)

x64dbg逆向实战:从反汇编到C语言还原的全流程 软件逆向工程中,将机器码还原为高级语言是核心技能。调试器作为动态分析利器,能逐条观察指令行为,但只有理解汇编与C语言的映射规则,才能从底层细节中重构出源代码逻辑。x64dbg作为Windows平台强大的开源调试器,通过栈帧分析、控制流映射和类型推断,可将函数参数、局部变量、循环分支等结构逐步还原。无论是CTF逆向、漏洞调试还是恶意代码分析,掌握从反汇编到C代码的推导方法都至关重要。本文以实际编译的最小校验函数为例,演示使用x64dbg定位函数、识别栈帧、还原循环与条件判断,并动态验证还原结果,帮助读者建立可 阅读详情

题目时空门

We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that a yuan for b kilos (You don’t need to care about what “yuan” is), the same as a / b yuan for a kilo.

Now imagine you’d like to buy m kilos of apples. You’ve asked n supermarkets and got the prices. Find the minimum cost for those apples.

You can assume that there are enough apples in all supermarkets.

Input
The first line contains two positive integers n and m (1 ≤ n ≤ 5 000, 1 ≤ m ≤ 100), denoting that there are n supermarkets and you want to buy m kilos of apples.

The following n lines describe the information of the supermarkets. Each line contains two positive integers a, b (1 ≤ a, b ≤ 100), denoting that in this supermarket, you are supposed to pay a yuan for b kilos of apples.

Output
The only line, denoting the minimum cost for m kilos of apples. Please make sure that the absolute or relative error between your answer and the correct answer won’t exceed 10 - 6.

Formally, let your answer be x, and the jury’s answer be y. Your answer is considered correct if这里写图片描述 .

Examples
inputCopy
3 5
1 2
3 4
1 3
output
1.66666667
inputCopy
2 1
99 100
98 99
output
0.98989899
Note
In the first sample, you are supposed to buy 5 kilos of apples in supermarket 3. The cost is 5 / 3 yuan.

In the second sample, you are supposed to buy 1 kilo of apples in supermarket 2. The cost is 98 / 99 yuan.

题意:

这个人想去超市买苹果,有n个超市,要买m斤苹果
接下来有n行,每行都是苹果的钱但都不是单价,代表B斤A元,可由此得单件是 A/B 但注意这里要改为浮点数 更为精确。

思路:

直接找最小单价 然后乘上要买的斤数即可。这里我当时写了一个 返回值为double 的判断函数竟然自动给我进位了,估计是c++与c的问题,然后直接写为if就过了 可怜。。emmm

代码:

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>

using namespace std;
const int N=1e5+10;


int main()
{
   // ios::sync_with_stdio(false);
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        double a,b;
        double minn=N*1.0;
        for(int i=1;i<=n;i++)
        {
            scanf("%lf%lf",&a,&b);
            if(minn>a/b)//这个地方 最初写了一个 判断函数结果答案不对 我也搞不懂 改成这个if判断就a了
                minn=a/b;
        }
        printf("%.8lf\n",m*minn);

    }
    return 0;
}
PAT(A) -- 2018.9.8秋季考试-甲级(1148-1151)详细题解 PAT(A) – 2018.9.8秋季考试-甲级 写在开头的话:甲级考试多是考查数据结构和一些基础的算法,此次也是我第一次参加PAT考试,赛前约刷了90道题(一个月),得到了一个80分以上的成绩,自我感觉得到了一下几方面的提升: 更加熟悉树、图相关数据结构及算法,其中如何利用前中序其二建树,如何最简单的表示邻接表,如何使用dijkstra算法及能记录路径等。 甲级考试中,例如动态规划这种算法... 阅读详情

相关推荐

Livox-avia+FAST-LIO麻瓜使用教程

激光雷达 SLAM Fastlio 安装

aaaaaaaaaww12的博客 3675

CodeForces 919

CodeForces 919A Supermarket 题目链接 题意:一个苹果a/b元,要买m个,问花费的最小钱数(结果保留8位小数) 思路:找a/b最小的即可。 #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;cstdlib&gt; #include&lt;cstring&gt; #include&lt;s...

Akatsuki 688

【mip-NeRF】使用一组二维图像渲染3D场景视频(mip-NeRF论文复现)

本文对mip-NeRF模型的pytorch实现进行了复现

Ryan2k的博客 1841

Codeforces Round #460 (Div. 2) 919-A-B-C

A. Supermarket time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output We often go to supermarkets to buy some fruits or vegetables, and on the t

辞树 445

卷积神经网络-猫狗识别(附源码)

利用python实现一个卷积神经网络,训练猫狗数据集,实现对猫狗图片的预测识别

m0_63223213的博客 2万+

最新虚拟串口 Virtual Serial Port Driver V11.0.1068 已经汉化

Virtual Serial Port Driver 11.0.1047 是一款功能强大的虚拟串口驱动程序,专为需要在开发和测试环境中模拟物理串口连接的用户设计。该版本于2023年4月5日发布,主要修复了在导入无效的COM端口捆绑设置时导致的崩溃问题,并优化了软件的自动更新功能。通过使用Virtual Serial Port Driver,用户可以在不依赖物理硬件的情况下,轻松创建和管理虚拟串口,极大地提高了开发和测试的效率。

中游鱼的博客 3万+

919A. Supermarket

A. Supermarket time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We often go to supermarkets to buy some frui

memory_qianxiao的博客 485

如何在离线的电脑上部署一个本地Deepseek(使用ollama)

例如,如果您的显卡显存为 16GB,官方推荐使用 32b 大小的 DeepSeek 模型。请根据您的硬件配置选择适合的模型版本,以获得最佳性能。首先我们需要将ollama和chatbox的安装包,Deepseek模型文件通过U盘或者光盘的形式导入到这台不能联网的电脑上。按照时间排序,找到最大的那个文件,就是gguf格式的模型,复制出来,改名为qwen2.5-coder0.5b.gguf。:基于开源模型(如 QWEN 和 LLAMA)微调,参数量从 1.5B 到 70B 不等,适合本地硬件部署。

qq_41854911的博客 1万+

codeforces Supermarket(水题,贪心)

A. Supermarket time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We often go to supermarkets to buy some frui

bestsort 601

烽火HG680-LC刷机后体验:当贝纯净桌面+讯飞语音,老盒子秒变智能电视的折腾记录

本文详细记录了烽火HG680-LC机顶盒刷机后的使用体验,通过安装当贝纯净桌面和讯飞语音助手,老盒子焕发新生,实现无广告、快速响应的智能电视功能。文章对比了刷机前后的性能差异,分享了影音播放、语音控制等实用功能,并提供了ADB调试和问题解决的实用技巧,帮助用户将闲置的运营商盒子变身为高性能的智能影音中心。

weixin_30292843的博客 469

maya导入导出bvh 自动 脚本

maya打开bvh脚本

jacke121的专栏 1550

Supermarket(CodeForces - 919A)

Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that a yuan for b kilos (You don’t need to care abou

ITzz_qqzi的博客 309

安装glibc出现../sysdeps/nptl/pthread.h:744:47:error:argument 1 of type ‘struct __jmp_buf_tag *‘ 解决方案

本文主要介绍了安装glibc出现…/sysdeps/nptl/pthread.h:744:47:error:argument 1 of type ‘struct __jmp_buf_tag *’ 解决方案,希望能对使用Linux的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 12万+

codeforces-919A Supermarket

A. Supermarkettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe often go to supermarkets to buy some fruits or vegetables, and on the tag there p...

language_zcx的博客 268

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

jre9下载 jdk9

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

Codeforces 919 A. Supermarket

这场cf有点意思,hack场,C题等于1的特判hack很多人(我hack成功3个人,上分了,哈哈哈,咳咳。。。) D题好像是树形dp,E题好像是中国剩余定理,F题好像还是dp,具体的不清楚,最近dp的题目好多,一会滚去学dp。 写A,B,C的题解。 A. Supermarket time limit per test 2 seconds m...

weixin_30951743的博客 155

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

CodeForces 919A Supermarket(水题)

     英语渣表示不想说话...AC代码:#include &lt;iostream&gt; #include &lt;cstdio&gt; using namespace std; int main() { int n,m; double price; while(scanf("%d%d",&amp;n,&amp;m)){ double a,b; price = 0...

Charles_Zaqdt的博客 411

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

http://codeforces.com/problemset/problem/919/A Supermarket

部分背包。 #include &lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; #define PI (M_PI) #define INF (0x3f3f3f3f) #define MOD (1000000007) #define EPS (1e-12) #define MAX (1000000) #define L...

Jack_zhuiyi的博客 208

浙南联合训练赛20180214

这场比赛题目还行,但是被一道数学题卡了 A - Supermarket CodeForces - 919A We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, whe...

weixin_33810006的博客 200

Codeforces Round #460 (Div. 2) A. Supermarket

A. Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk w

? 303

最少费用购物 动态规划

最少费用购物 ?问题描述:  商店中每种商品都有标价。例如,一朵花的价格是2元。一个花瓶的价格是5 元。为了  吸引顾客,商店提供了一组优惠商品价。优惠商品是把一种或多种商品分成一组,并降价销  售。例如,3朵花的价格不是6元而是5元。2 个花瓶加1 朵花的优惠价是10 元。试设计一 个算法,计算出某一顾客所购商品应付的最少费用。  编程任务:  对于给定欲购商品的价格和数量,以及优惠

fool宋的专栏 1万+

Codeforces Round #460 (Div. 2)题解ABC

A. Supermarkettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe often go to supermarkets to buy some fruits or vegetables, and on the tag there p...

Momo 417

【CodeForces - 919】 ABCD

A - Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk

lzs_lazy 491

[ 博弈论 ] Codeforces919F A Game With Numbers

发现数字的位置是没有影响的,那么可以用隔板法求出状态数为 (124)2=245025(124)2=245025{12\choose 4}^2=245025 。 然后不停用已确定的状态更新其他状态就好了。 #include&lt;bits/stdc++.h&gt; using namespace std; typedef unsigned long long ull; const int N...

gjghfd 466

关于一些初级ACM竞赛题目的分析和题解(七)。

关于一些初级ACM竞赛题目的分析和题解(七)             昨晚和cy1999相约一起打cf,结果晚了一个小时进的时候菜都快凉了,幸亏都skip了不然就掉分到newbie了,下面上题: A. Supermarket time limit per test 2 seconds memory limit per test 256 m

monster_ayb的博客 805
上一篇: Codeforces 919B (Prefect Number)
下一篇: Codeforces 915B (Browser)
Puppet__
博客等级 码龄10年 319粉丝 328原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值