首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
liux662
2026年3月9日 13:19
奥运排序问题 在原来那个佬的基础上加一个if判断题解:
P1310
回复 0
|
赞 13
|
浏览 159
#include <bits/stdc++.h> using namespace std; struct Node { // 直接用 struct,不用 typedef int gold_medal, medal, people; double gold_people, medal_people; }; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; while (cin >> n >> m) {...
liux662
2026年3月9日 13:04
奥运排序问题 样例人口数出现了0的情况 题解:
P1310
回复 1
|
赞 3
|
浏览 104
10 10 0 9 6 3 8 5 6 1 1 5 9 8 4 8 1 0 3 0 4 4 4 4 7 6 3 1 7 5 9 6 0 1 2 3 4 5 6 7 8 9 今天重新看这道题发现之前评论区有一个佬的代码过不了了,人口数为0的样例,有点怪怪的
ottata
2024年6月9日 11:39
奥运排序问题 题解:
P1310
回复 5
|
赞 63
|
浏览 2.3k
思路:有多少个比自己大的(如m),自己排序第m+1。 #include <bits/stdc++.h> using namespace std; struct country { int gold, award, people; double gm, am; }; int main() { int N, M; int i, j, k; while (cin >> N >> M) { country* countrys = new country[N]; ...
RingoCrystal
2025年2月11日 10:28
奥运排序问题 题解:代码巨大化,各种情况难以统一美化
P1310
回复 0
|
赞 20
|
浏览 1.8k
#include <bits/stdc++.h> using namespace std; struct medals { int golds, all_medals, people; medals(int golds, int all_medals, int people) : golds(golds), all_medals(all_medals), people(people) {}; bool operator==(medals b) { return golds == b.golds && ...
Kohi
2024年3月20日 13:59
奥运排序问题 题解:
P1310
回复 0
|
赞 22
|
浏览 1.9k
需要读懂题意。思路不难,写起来略繁琐。 即有n个国家的信息,排序后以规定格式输出指定的m个国家的最优排名和最优排名方式。 #include <bits/stdc++.h> using namespace std; typedef struct{ int num; int gold, total, man; double gm, tm; int t1, t2, t3, t4; }info; bool cmp1(const info ...
A001
2024年3月10日 13:55
奥运排序问题 题解:为什么只通过25%呢 ?请找错误用例 谢谢!!
P1310
回复 2
|
赞 2
|
浏览 1.8k
#include<stdio.h> #include<stdlib.h> struct C{ int gold;//金牌 int model;//奖牌 int people; float gp; float jp;//奖牌人均 int number;//国家号 int pm[10];/...
799
2024年3月8日 00:02
奥运排序问题 题解:4种排名4种排序,用一个新数组标记要打印国家
P1310
回复 0
|
赞 8
|
浏览 1.6k
#include<bits/stdc++.h> using namespace std; struct country{ int id;//国号 int gnum,mnum,pn;//金牌数,奖牌数,人口 double gRatio,mRatio;//金牌比例,奖牌比例 int r1,r2,r3,r4;//四种方式排名:金牌数,奖牌数,金牌比例,奖牌比例 }; bool cmp(country a, country b) {//国号排名 &nbs...
gallopzhang
2022年8月11日 16:29
这题意思难懂,而且陷阱多
P1310
回复 0
|
赞 7
|
浏览 6.2k
定义五种排序方式,具体细节可见代码,需要注意一点: 每次排序之后进行排名时需要对照相邻元素是否相等,如果相等排名可能会一样 #include <bits/stdc++.h> using namespace std; struct Country { int no, gold, medal, population; double gold_scale, medal_scale; int rank[4]; }; bool cmp1(C...
wenjuice
2022年3月7日 22:34
题目都读不明白,原来就是sort,为了简化代码,封装了一下
P1310
回复 0
|
赞 18
|
浏览 6.4k
#include<iostream> #include<algorithm> using namespace std; typedef struct { int num; // 编号 double data[4]; // 金牌 奖牌 金牌人口比例 奖牌人口比例 int people; // 人口 int rank[4]; // 排名 } Country; // 按金牌排名 bool cmp1(Country a, Country b) { return a.data[0] > b.data[0]; } // 按...
li_yi
2022年2月6日 23:28
参考Dear_MR_HE题解后的做法
P1310
回复 0
|
赞 6
|
浏览 6.8k
#include <iostream> #include<stdio.h> #include<algorithm> using namespace std; //定义结构体 typedef struct{ int id;//国家号 int gold_prize; //奥运金牌数 int total_prize; //奖牌数 int population; //人口数 float gold_ratio;//金牌比例 float total_ratio; //奖牌比例 ...
1
2
题目
奥运排序问题
题解数量
16
发布题解
在线答疑
热门题解
1
奥运排序问题 题解:
2
奥运排序问题 题解:
3
奥运排序问题 题解:代码巨大化,各种情况难以统一美化
4
题目都读不明白,原来就是sort,为了简化代码,封装了一下
5
奥运排序问题 在原来那个佬的基础上加一个if判断题解:
6
通俗易懂解法
7
奥运排序问题 题解:4种排名4种排序,用一个新数组标记要打印国家
8
这题意思难懂,而且陷阱多
9
感觉写得挺复杂的,但是思路还是比较清晰的
10
参考Dear_MR_HE题解后的做法