Created
May 24, 2012 23:52
-
-
Save yuuki/2784948 to your computer and use it in GitHub Desktop.
SRM Div2-146 250score
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
// {{{ Boilerplate Code <-------------------------------------------------- | |
// | |
// vim:filetype=cpp foldmethod=marker foldmarker={{{,}}} | |
#include <algorithm> | |
#include <bitset> | |
#include <cmath> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <ctime> | |
#include <deque> | |
#include <functional> | |
#include <iomanip> | |
#include <iostream> | |
#include <list> | |
#include <map> | |
#include <numeric> | |
#include <queue> | |
#include <set> | |
#include <sstream> | |
#include <stack> | |
#include <utility> | |
#include <vector> | |
#define FOR(I,A,B) for(int I = (A); I < (B); ++I) | |
#define REP(I,N) FOR(I,0,N) | |
#define ALL(A) (A).begin(), (A).end() | |
using namespace std; | |
// }}} | |
class YahtzeeScore | |
{ | |
public: | |
int maxPoints(vector <int> toss) | |
{ | |
vector<int> v(6); | |
for (vector<int>::iterator i = toss.begin(); i != toss.end(); ++i) { | |
v[*i - 1] += *i; | |
} | |
return *max_element(v.begin(), v.end()); | |
} | |
}; | |
int main() { | |
int s[5] = { 6, 4, 1, 1, 3 }; | |
vector<int> v; | |
v.assign(s, s + 5); | |
YahtzeeScore score; | |
cout << score.maxPoints(v) << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment