hdu-1031

来源:互联网 发布:中国软件和印度软件 编辑:程序博客网 时间:2024/06/14 09:43
#include<iostream>#include<fstream>#include<algorithm>using namespace std;struct node{    double value;    int pos;};int cmp1(node a,node b){    if(a.value==b.value)        return a.pos<b.pos;    return a.value>b.value;}int cmp2(node a,node b){    return a.pos>b.pos;}int main(){    //freopen("d:\\test.txt","r",stdin);    int n,m,k;    node a[1024];    while(!cin.eof() && cin>>n>>m>>k)    {        int i,j;        double d;        for(i=1;i<=m;++i)        {            a[i].value=0;            a[i].pos=i;        }        while(n--)            for(j=1;j<=m;++j)            {                scanf("%lf",&d);                a[j].value+=d;            }        sort(a+1,a+m+1,cmp1);        sort(a+1,a+k+1,cmp2);        for(i=1;i<k;++i)            printf("%d ",a[i].pos);        printf("%d\n",a[i].pos);    }    return 0;}

原创粉丝点击