Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int N;
- int M;
- int Votes;
- cin >> N;
- cin >> M;
- cin >> Votes;
- int CandidatesList[1000] = {0};
- for (int i = 0; i < M; i++)
- {
- for (int j = 0; j < N-1; j++)
- {
- if((Votes - 1) == j)
- CandidatesList[j] += 1;
- }
- }
- int MaxVotes = 0;
- for (int i = 0; i < N-1; i++)
- {
- if (CandidatesList[i] > MaxVotes)
- MaxVotes += CandidatesList[i];
- }
- for (int i = 0; i < N-1; i++)
- {
- if ((CandidatesList[i]) == MaxVotes)
- cout << i + 1 << " " ;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement