Home > Back-end >  Emergency!!!!!!
Emergency!!!!!!

Time:10-11

Examination!!!!!!
Please, help to look at this a few
Crab crab
Notify the school received a fellowship in Australia, the school will send delegations to visit our school in ten days, for a visiting delegation reception work, the school decided to selected from the whole school students to participate in one of the most popular students reception work, will all the n (10 & lt;=n<=1000) student uniform numbered (1, 2, 3, 4...... N), and regulations, each student can choose m (1 & lt;=m
Input format

Data, a total of n + 1 line, the first line: two data total n (10 & lt;=n<=1000), and each student can choose the number of m (1 & lt;=m
The output format

Data output formats: a total of one line, that is, the serial number of the most popular students, if appear many of the most popular students at the same time, in the same industry output, please all of the same student Numbers, separated by a space between number and number,

CodePudding user response:

#include
#include
#include
# define MAXN 1010

Int that [MAXN];
Int choices [MAXN];
Int main () {
Int N, M, I, j;
The scanf (" % d % d ", & amp; N, & amp; M);
For (I=0; iMemset (choices, 0, sizeof (choices));
For (j=0; jint choice;
The scanf (" % d ", & amp; Choice);
If (choice & lt; 1 | | choice & gt; N) continue;//invalid ticket
Choices [choice] + +;

If (choices (choice) & gt; 1) break;//
//a person, to another people vote many times, such as a row of data is 1 1 1
the condition of the//if you don't need to deal with this kind of situation, comment out the line
}
If (j)==M {
For (j=0; jThat [j] +=choices [j];
};
}
Int maxChoice=vote [1].
For (I=2; iIf (vote [I] & gt; That [maxChoice]) maxChoice=I;
For (int I=1; iIf (vote [I]==that [maxChoice])
Printf (" % d ", I);
return 0;
}

CodePudding user response:

CodePudding user response:

Generation into the sample is right, but not the AC, only 60 minutes

CodePudding user response:

who knows that the test data you want to consider how many kinds of legal and illegal votes of
This topic is to try, a no, continue to the second question? !
Go playing!

CodePudding user response:

 # include 
using namespace std;
Int main ()
{
Int n, m, a [10001]={}, I, j, b, Max=1, max_1 [10001], the sum=0;
Cin> N> m;
for(i=1; i<=n; I++)
{
For (j=1; j<=m; J++)
{
Cin> b;
[b] + +;
}
}
for(i=1; i<=n; I++)
{
If (a [I] & gt; Max) Max=a [I];
}
for(i=1; i<=n; I++)
{
If (a [I]==Max) max_1 [+ + sum]=I;
}
for(i=1; i<=sum; I++)
{
Cout}
return 0;
}