首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
RingoCrystal
2025年2月3日 15:23
找最小数 题解:自定义比大小,利用cpp机制
P1374
回复 0
|
赞 0
|
浏览 268
#include <bits/stdc++.h> using namespace std; struct newInt{ int x,y; newInt():x(0),y(0){} newInt(int x,int y):x(x),y(y){} bool operator<(newInt b){ if(x==b.x)return y<b.y; else return x<b.x; } }; int main(){ int n; whi...
Candour
2025年1月19日 15:31
找最小数(sort函数) 题解:
P1374
回复 0
|
赞 4
|
浏览 386
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> PII; const int N = 1010; PII s[N]; int n; bool cmp(PII a, PII b) { if(a.first == b.first) return a.second < b.second; return a.first < b.first; } int main() { while(cin >> n) { ...
拉萨小队长
2024年4月26日 22:17
找最小数 题解:结构体+sort()
P1374
回复 0
|
赞 1
|
浏览 482
#include<bits/stdc++.h> using namespace std; struct node{ int x,y; }p[100]; bool compare(node a,node b){ if(a.x==b.x) return a.y<b.y; else return a.x<b.x; } int main(){ ...
huanghu
2024年3月22日 17:28
找最小数 题解:c++
P1374
回复 0
|
赞 1
|
浏览 779
#include <iostream> #include <vector> using namespace std; struct minshu{ int x; int y; }; int main() { minshu m; minshu min[1000]; int n; cin>>n; for(int i = 0; i<n; i++){ int x,y; cin>>x>>y; min[i].x = x; min[i].y = y; } ...
小王桐学
2024年2月11日 20:57
找最小数 题解:C
P1374
回复 0
|
赞 4
|
浏览 887
#include <stdio.h> void Min(int a[][2],int n) { int i,index_x = 0,index_y = 0; for(i = 0; i < n; i++) //找到第一个x为最小 if(a[i][0] < a[index_x][0]) index_x = i; //在x相等的情况下找y最小 for(i = 0; i < n; i++) if(a[i][0] == a[index_x][0]) if(a[i][1] < a[index_x][1]) ...
wyz5008
2023年5月10日 17:21
找最小数 题解:
P1374
回复 0
|
赞 3
|
浏览 1.1k
因为只需要求一个最小数,我们不需要接受完数组再作操作,而是按照要求一边接受,一边判断最小值,最后直接输出即可。 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; int main() { int n; while(~scanf("%d",&n)) { int x,y; int lastx,lasty; for(int i=0; i<n...
kas
2022年3月16日 17:05
1374 找最小数
P1374
回复 0
|
赞 2
|
浏览 4.3k
#include<iostream> using namespace std; int main() { int n,x,y,sx,sy; cin >> n; for(int i = 0;i < n;++i){ cin >> x >> y; if(i == ...
题目
找最小数
题解数量
7
发布题解
在线答疑
热门题解
1
找最小数(sort函数) 题解:
2
找最小数 题解:C
3
找最小数 题解:
4
1374 找最小数
5
找最小数 题解:结构体+sort()
6
找最小数 题解:c++
7
找最小数 题解:自定义比大小,利用cpp机制