文章
3
粉丝
28
获赞
6
访问
1.4k
思路:有多少个比自己大的(如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];
for (i = 0; i < N; ++i) {
cin >> countrys[i].gold >> countrys[i].award >> countrys[i].people;
countrys[i].gm = (double)countrys[i].gold / countrys[i].people;
countrys[i].am = (double)countrys[i].award / countrys[i].people;
}
for (k = 0; k < M; ++k) {
cin >> k;
int rank[4] = {1, 1, 1, 1};
for (i = 0; i < N; ++i) {
if (countrys[k].gold < countrys[i].gold) rank[0]++;
if (countrys[k].award < countrys[i].award) rank[1]++;
if (countrys[k].gm < countrys[i].gm) rank[2]++;
if (countrys[k].a...
登录后发布评论
暂无评论,来抢沙发