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

1092 最好吃的月饼 (20 分)

时间:2019-03-01 12:46:16      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:class   name   nbsp   for   int   std   color   else   can   

#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool cmp(int a,int b){
    return a>b;
}
int main()
{
    int m,n;
    scanf("%d %d",&m,&n);
    int a[m+1]={0};
    int b[m+1]={0};
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d",&a[j]);
            b[j]+=a[j];
        }
    }
    int max1= -1,sign=0;
    for(int i=1;i<=m;i++){
        if(max1<b[i]){
            max1 = b[i];
        }
    }
    cout<<max1<<endl;
    for(int i=1;i<=m;i++){
        if(max1 == b[i]&&sign==0){
            cout<<i;
            sign=1;
        }
        else if(max1 == b[i]&&sign!=0){
            cout<<" "<<i;
        }
    }

    return 0;

}

 

1092 最好吃的月饼 (20 分)

标签:class   name   nbsp   for   int   std   color   else   can   

原文地址:https://www.cnblogs.com/tonyyy/p/10455508.html

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