文章
15
粉丝
446
获赞
2
访问
121.6k
正常做法
#include<bits/stdc++.h>
#define MAXINT 32767
using namespace std;
typedef long long ll;
typedef struct country{
int no;
int gd,sum;
double gdp,sump;
int best,bsort;
}country;
bool cmp1(country a,country b)
{
return a.gd>b.gd;
}
bool cmp2(country a,country b)
{
return a.sum>b.sum;
}
bool cmp3(country a,country b)
{
return a.gdp>b.gdp;
}
bool cmp4(country a,country b)
{
return a.sump>b.sump;
}
int main()
{
int n,m;
while(cin>>n>>m)
{
country a[n];
for(int i=0;i<n;i++)
{
a[i].no=i;
int a1,b;
double c;
cin>>a1>>b>>c;
a[i].gd=a1;
a[i].sum=b;
a[i].gdp=a1/c;
a[i].sump=b/c;
a[i].best=n+1;//the N+1(th)
}
int bsort,order;
//1
bsort=1;
sort(a,a+n,cmp1);
order=1;
for(int i=0;i<n;i++)
{
if(i&&a[i].gd!=a[i-1].gd)
order++;
if(a[i].best>order)
{
a[i].bes...
登录后发布评论
暂无评论,来抢沙发