C++
It is one of China's moon cake traditional cakes prestigious, since the Tang Dynasty, has developed hundreds of varieties.
For competitions a kind of "best eating" moon cake, eat goods sector that is bound to lead to a reign of terror in ...... here we use the number of words, given the country a variety of moon cake sales, requiring you to find out the sales champion, identified as the best to eat moon cake.
Input formats:
First, given two input positive integers N (≤1000) and M (≤100), respectively, the number of kinds of moon cake (moon cake so the default type number from 1 to N) and the number of cities participating statistics.
Next M rows, each row is given a non-negative integer N (no more than 1 million), which is an integer of i-th moon cake sales of the i-th (block). Between numbers separated by a space.
Output formats:
The maximum output volume in the first row, the type of the highest-numbered second row output moon cake volume. If the winner is not unique, press the numbers in ascending order output tied for the championship. Between numbers separated by a space, the line from beginning to end may not have the extra space.
Sample input:
5 3
1001 992 0 233 6
8 0 2018 0 2008
36 18 0 1024 4
Sample output:
2018
3 5
#include<iostream>
#include<vector>
using namespace std;
int main(){
// freopen("input.txt","r",stdin);
int a[1005];
fill(a, a+1005, 0);
int n,m,max_=0;
cin>>n>>m;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
int x;
scanf("%d",&x);
a[j] += x;
max_ = max(max_,a[j]);
}
}
printf("%d\n",max_);
int count=0;
for(int i=0;i<n;i++){
if(max_==a[i]){
if(count) printf(" ");
printf("%d",i+1);
count++;
}
}
return 0;
}