Y - Design T-Shirt(第二季水)
Description
Input
Output
Sample Input
Sample Output
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int N,M,K;
double s[][];
int cmp(const void *a,const void *b)
{
return *(int*)a<*(int*)b?:-;
}
void f(double sum[],int p[])
{
int k=,j,i;
while(k<K){
for(j=;j<M;j++){
bool flag=true;
for(i=;i<M;i++){
if(sum[j]<sum[i]){
flag=false;
break;
}
}
if(flag==true){
sum[j]=-;
p[k++]=j+;
break;
}
else continue;
}
}
}
int main()
{
while(scanf("%d %d %d",&N,&M,&K)!=EOF){
double sum[];
int p[];
int i=,j;
memset(sum,,sizeof(sum));
while(i<N){
for(j=;j<M;j++){
scanf("%lf",&s[i][j]);
sum[j]+=s[i][j];
}
i++;
}
f(sum,p);
qsort(p,K,sizeof(p[]),cmp);
for(i=;i<K;i++){
if(i==K-)printf("%d\n",p[i]);
else printf("%d ", p[i]);
}
}
//system("pause");
return ;
}
Y - Design T-Shirt(第二季水)的更多相关文章
- F - The Fun Number System(第二季水)
Description In a k bit 2's complement number, where the bits are indexed from 0 to k-1, the weight o ...
- D - Counterfeit Dollar(第二季水)
Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are t ...
- N - Robot Motion(第二季水)
Description A robot has been programmed to follow the instructions in its path. Instructions for the ...
- B - Maya Calendar(第二季水)
Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old ...
- S - 骨牌铺方格(第二季水)
Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数. 例如n=3时,为2× 3方格,骨牌的铺放方案有三种, ...
- R - 一只小蜜蜂...(第二季水)
Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. ...
- I - Long Distance Racing(第二季水)
Description Bessie is training for her next race by running on a path that includes hills so that sh ...
- L - 辗转相除法(第二季水)
Description The least common multiple (LCM) of a set of positive integers is the smallest positive i ...
- U - 神、上帝以及老天爷(第二季水)
Description HDU 2006'10 ACM contest的颁奖晚会隆重开始了! 为了活跃气氛,组织者举行了一个别开生面.奖品丰厚的抽奖活动,这个活动的具体要求是这样的: ...
随机推荐
- [Android] 输入系统(二)
在上一篇文章的最后,我们发现InputDispatcher是调用了InputChannel->sendMessage把键值发送出去,那么相应的,也有接收键值的地方.接收函数是InputChann ...
- 那些SQL语句
根据book_id,class_id确定老师uid select user_id from lessons left join book on lessons.lesson_id = book.les ...
- Delphi 使用自定义消息
Delphi 使用自定义消息 1.先用Const 定义一个常量,例如 const WM_MyMessage=WM_USER+$200; 2.在要实现的unit中定义一个私有方法 procedure ...
- 果酷:80后IT男“鲜果切”年入千万 _ 财经频道 _ 东方财富网(Eastmoney.com)
果酷:80后IT男"鲜果切"年入千万 _ 财经频道 _ 东方财富网(Eastmoney.com) 果酷:80后IT男"鲜果切"年入千万
- WebMagic开源垂直爬虫介绍
WebMagic项目代码分为核心和扩展两部分.核心部分(webmagic-core)是一个精简的.模块化的爬虫实现,而扩展部分则包括一些便利的.实用性的功能.WebMagic的架构设计参照了Scrap ...
- homebrew介绍
对于一个习惯了在 Ubuntu 的终端上通过 apt-get 来安装工具软件的我来说,也希望在Mac上找到类似的工具,能很方便的一条命令就能安装所需的软件,而不用手工的去查找下载编译,或者是折腾安装所 ...
- paip.gch预编译头不生效的原因以及解决:
paip.gch预编译头不生效的原因以及解决: 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/a ...
- HDU1007 Quoit Design 【分治】
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- nginx+keepalived实现nginx双主高可用的负载均衡
http://kling.blog.51cto.com/3320545/1253474 一.前言: 在互联网上面,网站为用户提供原始的内容访问,同时为用户提供交互操作.提供稳定可靠的服务,可以给用户带 ...
- 用shape结合selector实现点击效果
<span style="font-family:Arial, Helvetica, sans-serif;font-size:18px;background-color: rgb(2 ...