Skip to content

Commit b9782e9

Browse files
author
lazylzg
committed
Update test3-5找最小数.cpp
1 parent d47cdc6 commit b9782e9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

第3章排序与查找/3.2查找/test3-5找最小数.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ struct Point {
77
};
88
const int MAXN=1001;
99
Point point[MAXN];
10-
bool mycompare(Point a,Point b){
11-
if(a.x==b.x){
10+
bool mycompare(Point a,Point b) {
11+
if(a.x==b.x) {
1212
return a.y<b.y;
13-
}else{
13+
} else {
1414
return a.x<b.x;
1515
}
1616
}
1717
int main() {
1818
int n;
19-
while(scanf("%d",&n)!=EOF){
20-
21-
for(int i=0;i<n;i++){
19+
while(scanf("%d",&n)!=EOF) {
20+
for(int i=0; i<n; i++) {
2221
scanf("%d %d",&point[i].x,&point[i].y);
2322
}
2423
sort(point,point+n,mycompare);

0 commit comments

Comments
 (0)