Friday, December 12, 2014

TCHS SRM 52 250 pt - Tournament Judging solution

TCHS SRM 52 250 pt - Tournament Judging: http://community.topcoder.com/stat?c=problem_statement&pm=9822&rd=13485

TCHS SRM 52 250 pt - Tournament Judging editorial:  http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm52

TCHS SRM 52 250 pt - Tournament Judging solution: 

#include <iostream>
#include <cmath>
#include <vector>

class TournamentJudging {
 public: int getPoints(std::vector <int> rs, std::vector <int> cf) {
  int tot=0;
  double db;
  for(int i=0; i<rs.size(); i++) {
   db=(double)rs[i]/cf[i]; tot+=round(db);
  }
  return tot;
 }
};


for "round"ing to the nearest number in C++: http://www.cplusplus.com/reference/cmath/round/

No comments:

Post a Comment