Saturday, May 31, 2014

Topcoder High School SRM 4 250 pt - Level one - Winning Trick problem solution

Topcoder High School SRM 4 250 pt - Level one - Winning Trick problem statement: http://community.topcoder.com/stat?c=problem_statement&pm=6421&rd=10023

Topcoder High School SRM 4 250 pt - Level one - Winning Trick problem editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm4

Topcoder High School SRM 4 250 pt - Level one - Winning Trick problem solution: 

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class WinningTrick {
    public: double minimumSpeed(vector <int> s, int y) {
        double a=0.0;
        sort(s.begin(), s.end());
        if(s[s.size()-1]>y) a=s[s.size()-1]-y, a/=2.00;
        return a;
    }
};

No comments:

Post a Comment