Created
May 24, 2012 21:29
-
-
Save yuuki/2784347 to your computer and use it in GitHub Desktop.
SRM Div2-145 200score
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// {{{ Boilerplate Code <-------------------------------------------------- | |
// | |
// vim:filetype=cpp foldmethod=marker foldmarker={{{,}}} | |
#include <algorithm> | |
#include <bitset> | |
#include <cmath> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <ctime> | |
#include <deque> | |
#include <functional> | |
#include <iomanip> | |
#include <iostream> | |
#include <list> | |
#include <map> | |
#include <numeric> | |
#include <queue> | |
#include <set> | |
#include <sstream> | |
#include <stack> | |
#include <utility> | |
#include <vector> | |
#define FOR(I,A,B) for(int I = (A); I < (B); ++I) | |
#define REP(I,N) FOR(I,0,N) | |
#define ALL(A) (A).begin(), (A).end() | |
using namespace std; | |
// }}} | |
class ImageDithering | |
{ | |
public: | |
int count(string dithered, vector<string> screen) | |
{ | |
int sum = 0; | |
for (vector<string>::iterator str = screen.begin(); str != screen.end(); ++str) { | |
for (string::iterator pos = str->begin(); pos != str->end(); ++pos) { | |
for (string::iterator d = dithered.begin(); d != dithered.end(); ++d) { | |
if (*pos != *d) continue; | |
++sum; | |
} | |
} | |
} | |
return sum; | |
} | |
}; | |
int main() { | |
ImageDithering image; | |
string screen1[] = {"AAAAAAAA", | |
"ABWBWBWA", | |
"AWBWBWBA", | |
"ABWBWBWA", | |
"AWBWBWBA", | |
"AAAAAAAA"}; | |
vector<string> v(6); | |
v.assign(screen1, screen1 + 6); | |
cout << image.count("BW", v) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment