Skip to content

Instantly share code, notes, and snippets.

@danicat
Created January 6, 2014 12:52
Show Gist options
  • Save danicat/8282491 to your computer and use it in GitHub Desktop.
Save danicat/8282491 to your computer and use it in GitHub Desktop.
TopCoder SRM 145 Division 2 250 pts
#include <vector>
#include <string>
using std::vector;
using std::string;
class ImageDithering {
public:
int count(string dithered, vector<string> screen) {
int c = 0;
for(auto p : screen) {
for(int i = 0; i < p.length(); ++i) {
for(int j = 0; j < dithered.length(); ++j) {
if( p[i] == dithered[j] ) {
++c;
break;
}
}
}
}
return c;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment