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的颁奖晚会隆重开始了! 为了活跃气氛,组织者举行了一个别开生面.奖品丰厚的抽奖活动,这个活动的具体要求是这样的: ...
随机推荐
- 转:ElasticSearch 简单入门
原文来自于:http://www.oschina.net/translate/elasticsearch-getting-started?cmp 教程样例 我们将要部署一个非常简单的应用--在一个部门 ...
- Andoird 监听开机广播和关机广播
需求:有时候,我们需要自己的程序在开机后自动运行;在关机时,记录一些信息到文件中. 一.开机广播监听Android系统启动完成后会自动发出启动完成广播(android.intent.action.BO ...
- cf C. Hamburgers
http://codeforces.com/contest/371/problem/C 二分枚举最大汉堡包数量就可以. #include <cstdio> #include <cst ...
- JAVA简单的UI设计
手写代码,还是痛苦点,但对布局有再深入的流程理解, 全IDE会更快速.. package SwingGui.sky.com; import javax.swing.*; import java.awt ...
- keil优化等级设置
附表:Keil C51中的优化级别及优化作用 级别说明 0 常数合并:编译器预先计算结果,尽可能用常数代替表达式.包括运行地址计算. 优化简单访问:编译器优化访问8051系统的内部数据和位地址. 跳转 ...
- Bit,Bytes,KB,MB,GB,TB,PB,EB,ZB,YB
Bit,Bytes,KB,MB,GB,TB,PB,EB,ZB,YB 汉字字符 2字节英文字符 1字节中文标点 2字节英文标点 1字节一个字节就是一个八位二进制数啊,2就是00000010,4就是000 ...
- 【翻译】Organizing ASP.NET MVC solutions 如何组织你的ASP.NET MVC解决方案
序言 时隔一年,弦哥重出江湖,对于我们学习.NET MVC那将有大大的好处,期待弦哥的重构系列.在弦哥与jerrychou的交流中提到了一篇文章http://lostechies.com/jimmyb ...
- LeetCode——Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, ...
- 创建一个Android工程
Creating an Android Project 原文演示了怎么通过Android Studio和命令行两种方式来创建一个Android工程. 原文链接:http://developer.and ...
- 自定义UINavigationItem的两种方法以及相应的隐藏方法
第一种: UIImage *searchimage=[UIImage imageNamed:@"search.png"]; UIBarButtonItem *barbtn=[[[U ...