首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
saber.果
2024年3月6日 21:42
成绩排序 - 华科 题解:
P1404
回复 2
|
赞 0
|
浏览 765
求大佬帮忙看看,为什么不对 #include<bits/stdc++.h> using namespace std; struct Student{ char name[105]; int age; int grade; }stu[1005]; bool compareAsc(Student a,Student ...
小王桐学
2024年2月11日 21:18
成绩排序 - 华科 题解:C
P1404
回复 0
|
赞 2
|
浏览 1.1k
#include <stdio.h> #include <string.h> typedef struct{ char s[101]; int age; float grade; }Student; void Sort(Student stu[],int n) { int i,j; Student t; for(i = 0; i < n-1; i++) for(j = 1; j < n-i; j++) if(stu[j].grade < stu[j-1].grade) { ...
阔赛英
2023年2月2日 16:08
分数相同,按照名字排序;名字也相同,按照年龄排序
P1404
回复 0
|
赞 0
|
浏览 3.5k
#include <iostream> #include <string.h> #include <algorithm> using namespace std; struct Student { string name; int age; int score; } stu[64]; bool cmp(Student a, Student b) { if (a.score == b.score) {//分数相同,按照名字排序 if (a.name == b.name)...
tyu007
2020年3月30日 20:10
1404(注意排序的条件)
P1404
回复 1
|
赞 0
|
浏览 10.8k
举个例子,若满足a则。 AA。。。 在满足a 的条件下,有满足b,则。BB。。。。 所以,排序的条件得现已 a 为大入口,然后立即判断是否满足b ,接着处理 BB。否 AA 只有这样才能避免逻辑遗漏。 #include<bits/stdc++.h> #include<iostream> #include<string> #include<algorithm> using namespace std; ...
寂寞圣哲
2020年4月9日 18:19
华科-成绩排序(主要是重写比较方法+面向对象思想)+变式题1338
P1404
回复 0
|
赞 0
|
浏览 9.8k
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; /**1.此题关键在于新定义集合collection.sort方法,需要重写comparable<比较类型>接口中的compareTo的比较规则,默认方法是比较两个字符串,按照升序排 * 2.!!类需要实现接口才能重写里面的方法 * 3.数组或集合对象是可以直接输出的,输出方式可以重写t...
Jeff_zhu
2020年2月15日 10:36
将学生数据按成绩从高到低排序,实际样例有些歧义哈
P1404
回复 0
|
赞 1
|
浏览 12.4k
#include<bits/stdc++.h> using namespace std; struct Node { string name; int year, score; }; /* 按成绩从高到低排序, 如果成绩相同则按姓名字符的字典序排序, 如果姓名的字典序也相同则按照学生的年龄从小到大排序 */ int cmp(Node n1, Node n2) { if(n1.score != n2.score) { return n1.score < n2.score; } else...
1
2
题目
成绩排序 - 华科
题解数量
16
发布题解
在线答疑
热门题解
1
成绩排序 - 华科 题解:自定义排序函数
2
成绩排序(函数sort) - 华科 题解:
3
成绩排序 - 华科 题解:c++利用sort函数实现
4
vector,能快就快,把时间留给难题
5
成绩排序 - 华科 题解:C
6
成绩排序 - 华科 题解:暴力
7
成绩排序 - 华科 题解:
8
成绩排序 - 华科 题解:
9
成绩排序 - 华科 题解:
10
成绩排序 - 华科 题解:C语言:结构体