首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
找最小数
[编程题]找最小数
热度指数:24990
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 64M,其他语言128M
算法知识视频讲解
第一行输入一个数n,1 <= n <= 1000,下面输入n行数据,每一行有两个数,分别是x y。输出一组x y,该组数据是所有数据中x最小,且在x相等的情况下y最小的。
输入描述:
输入有多组数据。 每组输入n,然后输入n个整数对。
输出描述:
输出最小的整数对。
示例1
输入
5 3 3 2 2 5 5 2 1 3 6
输出
2 1
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(10)
邀请回答
收藏(95)
分享
提交结果有问题?
161个回答
87篇题解
开通博客
Huster水仙
发表于 2023-01-06 20:36:03
//只用比较,不用存储所有数据 #include<iostream> using namespace std; int main(){ int n,x,y,xmin,ymin; scanf("%d",&n); &nb
展开全文
aaaawei
发表于 2021-01-08 20:40:40
先定义两个int的结构体 然后对结构体排序 自定义排序算法 从小到大排序最后取第一组结构体就是最小的数这种方法适合输入很多组数据时候的代码 排序一次能得到从小到大的结构体#include<iostream>#include<cstdio>#include<alg
展开全文
渺小小螃蟹
发表于 2021-05-10 16:28:38
//这么写好快的 #include<stdio.h> int main() { int n,a[2][1000]={0},flag=0; while(scanf("%d",&n)!=EOF) { int i,j; for(
展开全文
牛烘烘
发表于 2022-03-24 19:09:26
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn=1000+10; struct cmp{
展开全文
Vinnnnnci
发表于 2023-02-18 09:19:42
pair配对+sort排序(利用字典默认先比较first,再比较second) #include<cstdio> #include<utility> #include<algorithm> using namespace
展开全文
云水间
发表于 2023-02-12 17:36:41
#include <stdio.h> #include <stdlib.h> typedef struct nums{ int x; int y; }NUMS; int cmp(const void*a,const void*b){ if(((NUMS
展开全文
复旦周杰伦
发表于 2023-02-28 22:27:38
#include <cstdio> int main() { int n; scanf("%d\n",&n); int arr[n][2]; for(int i=0;i<n;i++){ scanf("%d%d",&arr[i][0]
展开全文
兔兔加大油
发表于 2026-03-09 11:00:06
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int n,a,b,s; cin >> n; multimap&l
展开全文
在考古的小鱼干很有气魄
发表于 2023-03-18 11:56:02
#include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; int main(){ int n,mina = INF,minb = INF,a,b; cin>>n; while(n--){
展开全文
算法废物
发表于 2023-03-26 23:18:56
#include <algorithm> #include <iostream> #include <vector> using namespace std; //用类来存储x,y,通过vector存储,利用sort按照排序要求排序后输出vector[0]即可 c
展开全文
问题信息
数组
模拟
查找
难度:
161条回答
95收藏
16496浏览
热门推荐
通过挑战的用户
查看代码
海边的少年
2023-03-12 21:15:38
李卓贤
2023-03-12 21:08:30
晨零
2023-03-11 20:26:06
mm2001
2023-03-08 09:21:56
大牛来了_
2023-03-07 22:11:51
相关试题
一个10*10的矩阵(可以理解为棋...
去哪儿旅行
模拟
评论
(0)
有两个文件context.txt和...
去哪儿旅行
模拟
评论
(4)
一个文件里有10万个随机正整数,按...
去哪儿旅行
堆
模拟
评论
(4)
某徒步团队从甲地出发到乙地行走,去...
数学运算
评论
(1)
来自
2024年秋招-OPPO...
在React应用中实现一个复杂表单...
React
评论
(2)
找最小数
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
5 3 3 2 2 5 5 2 1 3 6
2 1