Thursday, July 3, 2014

TopCoder High School SRM 34 Level one - 250 pt - Quote Contest solution

TopCoder High School SRM 34 Level one - 250 pt - Quote Contest statement: http://community.topcoder.com/stat?c=problem_statement&pm=7594&rd=10769

TopCoder High School SRM 34 Level one - 250 pt - Quote Contest editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm34

TopCoder High School SRM 34 Level one - 250 pt - Quote Contest solution: 


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

class QuoteContest {
    public: string bestQuote(vector <string> q) {
        int b, c, ma=0;
        string d, e;
        for(int i=0; i<q.size(); i++) {
            stringstream a(q[i]);
            a>>b>>c>>d;
            if(b+c>ma) ma=b+c, e=d;
        }
        return e;
    }
};

No comments:

Post a Comment