TopCoder High School SRM 18 Level one - 250 pt - Apple Pie editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm18
TopCoder High School SRM 18 Level one - 250 pt - Apple Pie solution:
#include <iostream> #include <vector> class ApplePie { public: int getApples(std::vector <int> x, std::vector <int> y, std::vector <int> d, int n) { int idx=-1; for(int i=0; i<x.size(); i++) { if(x[i]>=0 && x[i]<=100 && y[i]>=0 && y[i]<=100) n--; if(n==0) {idx=d[i]; break;} } return idx; } };
No comments:
Post a Comment