Skip to content

Instantly share code, notes, and snippets.

@shnya
Created January 12, 2011 14:49
Show Gist options
  • Save shnya/776238 to your computer and use it in GitHub Desktop.
Save shnya/776238 to your computer and use it in GitHub Desktop.
SRM 290 Div2 250
class SpeedTyper
{
public:
string lettersToPractice(string letters, vector <int> times)
{
vector<int> times2;
int ave = 0;
for(size_t i = 0; i < times.size(); i++){
int time = times[i];
if(i != 0)
time -= times[i-1];
ave += time;
times2.push_back(time);
}
ave /= (double)times.size();
string res;
for(size_t j = 0; j < times2.size(); j++){
if(times2[j] > ave){
res.push_back(letters[j]);
}
}
return res;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment