题目:https://codeforces.com/problemset/problem/106/B
B. Choosing Laptop
Vasya is choosing a laptop. The shop has n laptops to all tastes.
Vasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested in all other properties.
If all three properties of a laptop are strictly less than those properties of some other laptop, then the first laptop is considered outdated by Vasya. Among all laptops Vasya does not consider outdated, he chooses the cheapest one.
There are very many laptops, which is why Vasya decided to write a program that chooses the suitable laptop. However, Vasya doesn’t have his own laptop yet and he asks you to help him.
Input
The first line contains number n (1 ≤ n ≤ 100).
Then follow n lines. Each describes a laptop as speed ram hdd cost. Besides,
speed, ram, hdd and cost are integers
1000 ≤ speed ≤ 4200 is the processor’s speed in megahertz
256 ≤ ram ≤ 4096 the RAM volume in megabytes
1 ≤ hdd ≤ 500 is the HDD in gigabytes
100 ≤ cost ≤ 1000 is price in tugriks
All laptops have different prices.

Output
Print a single number — the number of a laptop Vasya will choose. The laptops are numbered with positive integers from 1 to n in the order in which they are given in the input data.

Examples
Input
5
2100 512 150 200
2000 2048 240 350
2300 1024 200 320
2500 2048 80 300
2000 512 180 150
Output
4
Note
In the third sample Vasya considers the first and fifth laptops outdated as all of their properties cannot match those of the third laptop. The fourth one is the cheapest among the laptops that are left. Thus, Vasya chooses the fourth laptop.

题意:这道题是根据三个属性和价格选择笔记本电脑,如果笔记本电脑的所有三个属性都严格低于其他笔记本电脑的属性,那么第一台笔记本电脑被Vasya认为已经过时了。在Vasya认为不过时的所有笔记本电脑中,他会选择了最便宜的笔记本电脑,并输出它的编号。

解题思路:开数组存入三个电脑得属性,任意一个与其他电脑的三个配置比较一旦有三个都比其他电脑地的情况就让它价格变得很大,因为我们筛选出不过时得电脑之后,还要比较价格 找出最便宜的笔记本电脑;然后,输出它 的编号 即可;

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main()
{int n,s[101],r[101],h[101],c[101],i,min,k,j;scanf("%d",&n);for(i=0;i<n;i++)  {scanf("%d %d %d %d",&s[i],&r[i],&h[i],&c[i]);}for (i=0;i<n;i++)//一个电脑与其他电脑比较三个配置,{for (j=0;j<n;j++) {   if(i!=j){if ((s[i]<s[j])&&(r[i]<r[j])&&(h[i]<h[j]))//但前电脑属性有三个比其它电脑低时,就让它的价格很大(大于一千就可以)这样就不会选择它了;{c[i]=1002;}}}}k=-1;//小于0都可以;min=1002;for (i=0;i<n;i++){if (c[i]<min)//找价格最少的电脑;{min=c[i];k=i;//记录下它的编号}}printf("%d\n",k+1);//这里我们之前是从零开始,所以需要+1;return 0;
}

B. Choosing Laptop相关推荐

  1. Codeforce 106B Choosing Laptop

    题意: V想买电脑,花最小的钱,且不是从性能的三个方面都被其他任意一个电脑全部压制的电脑的编号. 代码: #include<bits/stdc++.h> using namespace s ...

  2. 微软 Surface Pro、Studio、Laptop 全线更新

    2019独角兽企业重金招聘Python工程师标准>>> 今晨,微软在纽约的秋季新品发布会上,发布了 Surface Pro 6.Laptop 2 以及最顶级的 Studio 2 三款 ...

  3. 吴恩达机器学习笔记55-异常检测算法的特征选择(Choosing What Features to Use of Anomaly Detection)

    吴恩达机器学习笔记55-异常检测算法的特征选择(Choosing What Features to Use of Anomaly Detection) 对于异常检测算法,使用特征是至关重要的,下面谈谈 ...

  4. android studio 7200u,超惊艳的设计!微软正式将Surface Studio和Surface Laptop带进中国:设计师们都看哭了...

    昨晚,微软在上海召开了一场发布会.正式将之前已经发布的Surface Studio和Surface Laptop带入了中国市场,并且还在中国首发了第五代的Surface Pro. 话不多说,先来看下此 ...

  5. A Network in a Laptop: Rapid Prototyping for Software-Defined Networks

    文章名称:A Network in a Laptop: Rapid Prototyping for  Software-Defined Networks 文章来源:Lantz B , Heller B ...

  6. 有一个OEM制造商代理做HP笔记本电脑(Laptop),后来该制造商得到了更多的品牌笔记本电脑的订单Acer,Lenovo,Dell,该OEM商发现,如果一次同时做很多个牌子的本本,有些不利于管理。利

      有一个OEM制造商代理做HP笔记本电脑(Laptop),后来该制造商得到了更多的品牌笔记本电脑的订单Acer,Lenovo,Dell,该OEM商发现,如果一次同时做很多个牌子的本本,有些不利于管理 ...

  7. Error while retrieving the leader gateway. Retrying to connect to akka.tcp://flink@laptop:xxxx

    想进行query state的时候碰到了这么个问题: flink-appleyuchi-standalonesession-2-Desktop.log:2020-09-28 18:10:22,669 ...

  8. 64位Ubuntu kylin 16.04 安装laptop mode解决关闭盖子无法唤醒,并解决安装此模式后鼠标间歇断电

    建议以后安装分配交换空间,就不会碰到这种无法唤醒的鸟事了. 出处:http://blog.csdn.net/huludan/article/details/52725594 出处:http://www ...

  9. CF372D. Choosing Subtree is Fun

    CF372D. Choosing Subtree is Fun Solution 想了一晚都不会,一觉醒来就悟了QwQQwQQwQ 之前一直想着如何用类似树形DPDPDP的方法求出每一个点的贡献再合并 ...

最新文章

  1. 信息系统项目管理师历年论文题目
  2. 开课提醒 | 听顶会大佬透析前沿算法,解密人脸识别技术
  3. OpenGL EnvironmentMapping环境映射的实例
  4. 自然数从1到n之间,有多少个数字含有1
  5. java中list方法addall怎么写_简历中个人优势怎么写?| 四大方法教你打造独一无二“个人标签”...
  6. java8 两个list合并_深入介绍和使用 Java 8 的 Collector 接口和 Collectors 工具类
  7. 给控件做数字签名之二:生成证书文件
  8. iPhone UI 元素大小
  9. 全屏窗口指令_在iOS 14系统中,快捷指令原来有多达11种运行方式(上篇)
  10. 软件开发文档编写规范
  11. STM32数据可视化显示——纸飞机串口调试助手的使用
  12. 文件二维码、社交媒体二维码如何制作?
  13. 基于Android的办公自动化系统APP设计与实现
  14. 嗨!爱莫就是传说中隔壁家公司 | 精彩传送门
  15. ACRANSAC之我见
  16. Sam Altman专访:GPT-4没太让我惊讶,ChatGPT则让我喜出望外
  17. 吴恩达深度学习课件和课后习题
  18. Python下载微信公众号文章和图片保存至本地
  19. AttributeError: module ‘skimage.measure‘ has no attribute ‘compare_mse‘
  20. python定义全局变量 跨文件使用

热门文章

  1. 100内奇数之和流程图_数字物理猎奇研究|纯奇数数集中的加法,法则中的“n”的含义...
  2. 爱奇艺APP全面适配iOS 14 首批支持画中画功能 追剧聊天两不误
  3. python 开课了_解答你学习Python的困惑,《Python小白成长记》开课啦
  4. R329 NASNet模型仿真测试
  5. 偶像工场,开启虚拟人数字藏品新时代
  6. JavaScript基本入门教程
  7. css取第一个孩子,CSS:第n个孩子():后(css :nth-child() :after)
  8. IDEA Swagger 配置
  9. 记录一下,深圳医疗保险医院及药店
  10. 二叉树遍历(递归实现前序/中序/后序遍历)