Programming Challenges – 호주식 투표법(Australian Voting)

https://transculturalexchange.org/cbfc38sb39 문제 <- 클릭

https://nedediciones.com/uncategorized/vju4tg6xu

https://www.completerehabsolutions.com/blog/n9dow08m 아.. 이건 또 뭐가 문제지…? 체스 문제 처럼 나중에 다시보면 또 눈에 보이겠지.
시간 낭비는 하지말자.. 바쁘다!

Buy Pfizer Xanax 2Mg #include #include #include #include typedef std::vector Numbers; class AustralianVoting { std::vector candidates; std::vector persons; std::vector votes; std::vector eliminated; bool checkMoreVotes() { int max = 0; std::vector::iterator it; for (it = votes.begin(); it != votes.end(); ++it) { if (max < *it) max = *it; // std::cout << *it << std::endl; } if (max > (int) persons.size() / 2) { // std::cout << "max > 50% : No more...." << std::endl; return false; } else if (votesAreSame()) { // std::cout << "Alive are Same : No more...." << std::endl; return false; } // std::cout << "More.." << std::endl; return true; } bool votesAreSame() { bool flag = true; int pre; int index = 0; std::vector::iterator it; for (it = votes.begin(); it != votes.end(); ++it) { if (!eliminatedHas(index)) { if (flag) { pre = *it; flag = false; } else { if (pre != *it) return false; } } ++index; } return true; } int getBest() { int max = 0; int index = 0; std::vector::iterator it; for (it = votes.begin(); it != votes.end(); ++it) { if (!eliminatedHas(index)) { if (max < *it) max = *it; } ++index; } return max; } int getWorst() { bool flag = true; int min = 1000; int index = 0; std::vector::iterator it; for (it = votes.begin(); it != votes.end(); ++it) { if (!eliminatedHas(index)) { if (flag) { min = *it; flag = false; } else { if (min > *it) min = *it; } } ++index; } return min; } bool eliminatedHas(int val) { std::vector::iterator it; for (it = eliminated.begin(); it != eliminated.end(); ++it) { if (*it == val) return true; } return false; } void voteR(std::vector& vec, int depth) { if (depth > (int) candidates.size() - 1) return; // std::cout << "depth = " << depth << std::endl; int sizeI = vec.size(); int sizeJ = votes.size(); for (int i = 0; i < sizeI; ++i) { if (!eliminatedHas(vec[i][depth])) votes[vec[i][depth]] = votes[vec[i][depth]] + 1; } int worst = getWorst(); if (checkMoreVotes()) { std::vector store; for (int j = 0; j < sizeJ; ++j) { if (!eliminatedHas(j)) { if (votes[j] == worst) { eliminated.push_back(j); // std::cout << j << " : eliminated(" <::iterator it; for (it = votes.begin(); it != votes.end(); ++it) { if (!eliminatedHas(index)) { if (*it == getBest()) std::cout << candidates[index] << std::endl; } ++index; } } void reset() { candidates.clear(); persons.clear(); votes.clear(); eliminated.clear(); } void printNumbers() { int sizeI = persons.size(); int sizeJ = candidates.size(); for (int i = 0; i < sizeI; ++i) { for (int j = 0; j < sizeJ; ++j) { std::cout << persons[i][j] << " "; } std::cout << std::endl; } } void pushNumbers(Numbers& numbers) { persons.push_back(numbers); } void pushCandidates(std::string& name) { candidates.push_back(name); votes.push_back(0); } }; int main() { AustralianVoting av; std::string buffer; int numberOfCase; int numberOfCandidates; std::cin >> numberOfCase; std::getline(std::cin, buffer); for (int i = 0; i < numberOfCase; ++i) { if (i != 0) std::cout << std::endl; std::cin >> numberOfCandidates; // std::cout<<"numberOf Candidates : "<> num) { nums.push_back(num - 1); } // std::cout<<"nums size : "<

One thought on “Programming Challenges – 호주식 투표법(Australian Voting)

  1. very 재미

답글 남기기

https://merangue.com/1u5gzu0 이메일 주소는 공개되지 않습니다.

You may use these HTML tags and attributes:

Brand Xanax Online <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

https://mandikaye.com/blog/d89niaowj6k

https://udaan.org/wjgnawfbye.php

https://homeupgradespecialist.com/1f7fur9

https://www.clawscustomboxes.com/08dhuyy

https://eloquentgushing.com/11bhxpwh

https://aiohealthpro.com/2efu91x 이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.