BUPT复试专题—找最小数(2010)
https://www.nowcoder.com/practice/ba91786c4759403992896d859e87a6cd?tpId=67&tqId=29645&rp=0&ru=/kaoyan/retest/1005&qru=/ta/bupt-kaoyan/question-ranking
题目描述
输入描述:
输入有多组数据。
每组输入n,然后输入n个整数对。
输出描述:
输出最小的整数对。
输入
5
3 3
2 2
5 5
2 1
3 6 找最小数,两层判断
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string.h>
using namespace std;
struct Donser
{
int x;
int y;
};
int main()
{
int num;
while(scanf("%d",&num)!=EOF)
{
int i=,minx=,miny=;
Donser donser[];
while(i++<num)
{
scanf("%d %d",&donser[i].x,&donser[i].y);
}
for(int j=;j<=num;j++)
{
if(donser[j].x<minx)
{
minx=donser[j].x;
miny=donser[j].y;
}
else if(donser[j].x==minx)
{
if(donser[j].y<miny)
{
minx=donser[j].x;
miny=donser[j].y;
}
}
}
cout<<minx<<" "<<miny<<endl;
}
return ;
}
输出
2 1
BUPT复试专题—找最小数(2010)的更多相关文章
- BUPT复试专题—C翻转(2010)
https://www.nowcoder.com/practice/74bdb725421c4f80b4aca7266818baf0?tpId=67&tqId=29639&rp=0&a ...
- BUPT复试专题—找K小数(2011)
https://www.nowcoder.com/practice/204dfa6fcbc8478f993d23f693189ffd?tpId=67&tqId=29637&rp=0&a ...
- BUPT复试专题—比较奇偶数(2010)
https://www.nowcoder.com/practice/188472f474d5421cb8218b8ad561023b?tpId=67&tqId=29636&rp=0&a ...
- BUPT复试专题—哈夫曼树(2010)
https://www.nowcoder.com/practice/162753046d5f47c7aac01a5b2fcda155?tpId=67&tqId=29635&tPage= ...
- BUPT复试专题—寻找第 K 小的数(2009)
题目描述 给你 n 个完全不相同整数(n<=300),每一个数都大于 0 并且小于 1000,请找出 第 k 小的数. 输入 输入包括两行,第一行用空格隔开的两个数 n 和 k;第二行有 n 个 ...
- BUPT复试专题—内存分配(2014-2)
题目描述 在操作系统中,内存分配是非常重要的工作.己知内存空间由N个内存块组成,这些内存块从1到N编号.进行内存分配时,操作系统将选择一块大小足够的内存全部分配给请求内存的进程.例如,当进程请求10M ...
- BUPT复试专题—Python List(2014)
题目描述 在Python中,List (列表)是一种非常重要的数据结构.它与C/C++/Java中的 数组有些类似,但支持添加新元素时的动态扩展.在这个问题中,你需要处理如下 的几种对List的操作. ...
- BUPT复试专题—解析表达式(2015)
题目描述 输入一个字符串形式的表达式,该表达式中包括整数,四则运算符(+.-.*./),括号,三角函数(sin(x).cos(x).tan(x)),底数函数(lg(x).ln(x)),计算该表达式的值 ...
- BUPT复试专题—字符串转换(2013计院)
题目描述 我们将仅由若干个同一小写字母构成的字符串称之为简单串,例如"aaaa"是一个简单串,而"abcd"则不是简单串.现在给你一个仅由小写字母组成的字符串, ...
随机推荐
- Bluefruit LE Sniffer - Bluetooth Low Energy (BLE 4.0) - nRF51822 驱动安装及使用
BLE Sniffer https://www.adafruit.com/product/2269 Bluefruit LE Sniffer - Bluetooth Low Energy (BLE 4 ...
- verilog behaviral modeling -- procedural timing contronls
1.delay control : an expression specifies the time duration between initially encountering the state ...
- 王小胖之 URL编码和解码
使用场景:程序员使用较多,主要是图个方便,实现很简单 实现功能:URL编码 和URL解码 数据实例: 输入:王小胖好啊,王小胖顶呱呱!! ~~ english 123 !@#$%^&*()_+ ...
- python-leepcode-作用解析 - 5-27
30 找不同 给定两个字符串 s 和 t,它们只包含小写字母. 字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字母. 请找出在 t 中被添加的字母. 示例: 输入: s = "a ...
- Python9-day3-作业
ascli 字母,数字.特殊字符,1个字节.8位 unicode:16位 两个字节,升级32位,四个字节 utf-8:最少一个字节 8位,英文字母, 1,有变量name = "aleX l ...
- 【HDU 2126】Buy the souvenirs(01背包)
When the winter holiday comes, a lot of people will have a trip. Generally, there are a lot of souve ...
- 关于学习Mongodb的几篇文章
一.Mongodb分片的使用 http://www.caiyiting.com/blog/2014/mongodb-sharding.html 二.MongoDB分布式高可用集群实现 http://w ...
- java 协程框架quasar gradle配置
https://github.com/puniverse/quasar-gradle-template/blob/master/gradle/agent.gradle 1.将其中的"-jav ...
- 在后台编辑器Text和Visual切换时,部分代码丢失的解决方法
function fix_tiny_mce_before_init( $in ) { // You can actually debug this without actually needing A ...
- 鼠标移动或者鼠标点击div消失不见排查
点击事件,导致某div或者容器样式隐藏,如果不能直接发现click事件绑定,那么首先排查哪些方法在控制div的样式, 然后看一看哪些方法在调用修改样式的方法. 然后再排查什么在调用修改样式的方法的方法 ...