TCHS SRM 55 250 pt - Very Interesting Movie editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm55
TCHS SRM 55 250 pt - Very Interesting Movie solution:
#include <iostream> #include <vector> class VeryInterestingMovie { public: int maximumPupils(std::vector <std::string> s) { int a=0, f=0; for(int i=0; i<s.size(); i++, f=0) for(int j=0; j<s[i].length(); j++) { if(s[i][j]=='Y' && f==0) a++, f=1; else if((s[i][j]=='Y' && f==1) || s[i][j]=='N') f=0; } return a; } };
No comments:
Post a Comment