文章
20
粉丝
224
获赞
57
访问
138.7k
#include<bits/stdc++.h>
using namespace std;
struct Country {
int id; // 国家号
int goldNum, medalNum; // 金牌数和奖牌数
float goldRatio, medalRatio; // 金牌人口比例和奖牌人口比例
int rank1 = 0, rank2 = 0, rank3 = 0, rank4 = 0; // 四种排名方式对应的排名
} country;
bool cmp(Country c1, Country c2) {
return c1.id < c2.id;
}
bool cmp1(Country c1, Country c2) {
return c1.goldNum > c2.goldNum;
}
bool cmp2(Country c1, Country c2) {
return c1.medalNum > c2.medalNum;
}
bool cmp3(Country c1, Country c2) {
return c1.goldRatio > c2.goldRatio;
}
bool cmp4(Country c1, Country c2) {
return c1.medalRatio > c2.medalRatio;
}
int main() {
int N, M;
while (cin >> N >> M) {
vector<Country> countries;
int goldNum, medalNum, population, rank = 1, index[M];
for (int i = 0; i < N; ++i) {
cin >> goldNum >> medalNum >> population;
country.id = i;
country.goldNum = goldNum;
country.medalNum = medalNum;
...
登录后发布评论
暂无评论,来抢沙发