首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
我爱陈少熙
2024年3月12日 17:21
成绩排序2.0 题解:c语言的qsort实现
P1159
回复 0
|
赞 1
|
浏览 1.1k
#include<stdio.h> #include<stdlib.h> #include<string.h> struct stu { int num; int score; }s[]; int cmp(const void*a,const void*b) { struct stu *c=(struct stu*)a; struct stu *d=(struct stu*)b; if(c-...
FIVEszc
2024年3月10日 10:50
成绩排序2.0 题解:C++
P1159
回复 0
|
赞 0
|
浏览 1.2k
#include <bits/stdc++.h> using namespace std; typedef struct student { int num; int grade; }; bool comp (student lhs,student rhs) { if(lhs.grade<rhs.grade) return true; else if(lhs.grade==rhs.grade && lhs.num<rhs.num) return true; ...
starry sky
2024年3月9日 21:38
成绩排序2.0 题解:
P1159
回复 0
|
赞 0
|
浏览 943
#include<iostream> #include<set> using namespace std; struct compare { bool operator()(const pair<int, int>& a, const pair<int, int>& b)const { if (a.second == b.second) &n...
A001
2024年3月8日 15:37
成绩排序2.0 题解:为什么通过数据只有75%啊 球球了 帮我找出错误
P1159
回复 2
|
赞 5
|
浏览 1.9k
#include<stdio.h> #include<string.h> #include<stdlib.h> int m,n; int main(){ int x; scanf("%d",&x); int a[110];int b[110]; for(int i=0;i<x;i++) scanf("%d %d",&a[i],&b[i]); for(...
williams
2024年3月7日 14:24
成绩排序2.0 题解:c
P1159
回复 8
|
赞 0
|
浏览 1.5k
#include <stdio.h> #include <stdbool.h> #include <math.h> #include <string.h> //object:按照成绩升序排列,成绩相同则按照学号升序排列 struct student{ int number,score; }data[1000],temp; int main(void){ int n,j,u; while(scanf("%d",&n)!=EOF){ for(int i=0;i<...
orderrr
2024年2月25日 15:39
成绩排序2.0 题解:
P1159
回复 0
|
赞 0
|
浏览 1.2k
思想: 自定义 cmp 判断方法, 当 分数一样就 return p.index < q.index // index 是学生编号 #include <bits/stdc++.h> using namespace std; struct student { int index; int value; }; bool cmp(student x, student y) { if (x.value == y.value) { return x.index < y.i...
小王桐学
2024年1月31日 22:15
成绩排序2.0 题解:C
P1159
回复 0
|
赞 0
|
浏览 1.3k
#include <stdio.h> typedef struct{ int x; int s; }Student; //排序:先按成绩s从小到大;如果学生的成绩相同,则按照学号的大小进行从小到大排序。 void Sort(Student stu[],int n) { //先按学号从小到大排序(学号互异) //再进行稳定排序(从最后向前每次选择最大的数放最后) int i,j; Student temp; for(i = 0; i < n-1; i++) //学号排序 for(j = 1; j < n-i; ...
carrot_huan
2024年1月29日 04:16
成绩排序2.0 题解:用pair 实现排序
P1159
回复 0
|
赞 0
|
浏览 1.6k
#include<bits/stdc++.h> using namespace std; int cmp(pair<int, int>a, pair<int, int >b) { if (a.second == b.second) return a.first < b.first; else return a.second < b.second; } int main() { &...
Cookie‘s AE86
2024年1月23日 14:37
成绩排序2.0 题解:sort函数实现
P1159
回复 0
|
赞 1
|
浏览 1.3k
#include <bits/stdc++.h> using namespace std ; typedef struct student{ //定以结构体 int id ; //学号 int score ; //成绩 } Student ; bool cmp(Student a ,Student b){ if(a.score == b.score) return a.id < b.id; //成绩相等取学号小的 else return a.score < b.score ; } ...
LianG_nnuo
2022年11月15日 10:39
c 简单数组冒泡
P1159
回复 1
|
赞 1
|
浏览 6.5k
#include<stdio.h> #include<stdlib.h> #include<string.h> /* 输入第一行包括一个整数N(1<=N<=100),代表学生的个数。 接下来的N行每行包括两个整数p和q,分别代表每个学生的学号和成绩。 输出描述: 按照学生的成绩从小到大进行排序,并将排序后的学生信息打印出来。 如果学生的成绩相同,则按照学号的大小进行从小到大排序。 输入输出样例 输入样例#: 复制 3 1 90 2 87 3 92 输出样例#: 复制 2 87 1 90 3 92 *...
1
2
3
4
5
题目
成绩排序2.0
题解数量
41
发布题解
在线答疑
热门题解
1
成绩排序2.0 题解:记录一下
2
成绩排序2.0 题解:
3
成绩排序2.0 题解:
4
成绩排序2.0 题解:
5
成绩排序2.0 题解:暴力至高
6
成绩排序2.0 题解:
7
成绩排序2.0 题解:为什么通过数据只有75%啊 球球了 帮我找出错误测试数据吧 感谢
8
成绩排序2.0 题解:改了好多次了,一直都通过不了
9
成绩排序2.0 (C++)题解:
10
成绩排序2.0 题解: