码迷,mamicode.com
首页 > 其他好文 > 详细

vjudge B - Design T-Shirt

时间:2018-04-14 20:44:20      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:http   思路   text   code   ios   模拟   space   ram   algo   

思路:水题,模拟即可。
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,k;
struct nond{
    double val;int id;
}pe[100001];
int cmp1(nond a,nond b){
    if(a.val==b.val)    return a.id<b.id;
    return a.val>b.val;
}
int cmp2(nond a,nond b){
    return a.id>b.id;
}
int main(){
    while(scanf("%d%d%d",&n,&m,&k)!=EOF){
        for(int i=1;i<=n;i++)
            for(int j=1;j<=m;j++){
                double x;scanf("%lf",&x);
                pe[j].val+=x;
            }
        for(int i=1;i<=m;i++)    pe[i].id=i;
        sort(pe+1,pe+1+m,cmp1);
        sort(pe+1,pe+1+k,cmp2);
        for(int i=1;i<k;i++)
            cout<<pe[i].id<<" ";
        cout<<pe[k].id<<endl;
        memset(pe,0,sizeof(pe));
    }
}

 

vjudge B - Design T-Shirt

标签:http   思路   text   code   ios   模拟   space   ram   algo   

原文地址:https://www.cnblogs.com/cangT-Tlan/p/8834603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!