Created
March 21, 2018 20:48
-
-
Save Florian3k/b1790060ec7d004a0f588989d76279ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <algorithm> | |
| #include <numeric> | |
| #include <iterator> | |
| int findWinner( float c[30][5] ) | |
| { | |
| float maxes[30]; | |
| for ( int i = 0; i < 30 ; i++ ) { | |
| auto minmax = std::minmax_element( | |
| std::begin(c[i]), | |
| std::end(c[i]) | |
| ); | |
| maxes[i] = std::accumulate( | |
| std::begin(c[i]), | |
| std::end(c[i]), | |
| 0 | |
| ) - *minmax.first - *minmax.second; | |
| } | |
| return std::distance( | |
| std::begin(maxes), | |
| std::max_element( | |
| std::begin(maxes), | |
| std::end(maxes), | |
| [](int a, int b){return a < b;} | |
| ) | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment