我的个人网站 Cheese的个人主页http://www.cheese.ren/
博客来源 PAT 乙级 1092 最好吃的月饼-Cheese的个人博客PAT 乙级 1092 最好吃的月饼 C++http://blog.cheese.ren/112
欢迎交换友链 :-)
#include <bits/stdc++.h>
using namespace std;
int main() {
int mooncake_kind_count, city_count;
cin >> mooncake_kind_count >> city_count;
int mooncake[1001]={0}, max=-1;
for (int i=0; i<city_count; i++) {
for (int l=0; l<mooncake_kind_count; l++) {
int temp;
cin >> temp;
mooncake[l] += temp;
if (mooncake[l] >= mooncake[max])
max = l;
}
}
cout << mooncake[max] << endl;
for (int i=0; i<mooncake_kind_count; i++) {
if (mooncake[max] == mooncake[i]) {
cout << i + 1;
if (max != i)
cout << " ";
else
cout << endl;
}
}
return 0;
}