SRM527 Div2 Easy(250) P8XMatrixTransformation
1種類の操作しかできないと言いながら、任意の配置にすることが可能なので、1の個数が等しいかどうかだけ見れば良い。
#include <string> #include <vector> using namespace std; class P8XMatrixTransformation{public: string solve( vector <string> original, vector <string> target ) { int co=0, ct=0; for ( int y=0; y<(int)original.size(); y++ ) for ( int x=0; x<(int)original[y].size(); x++ ) co += original[y][x]-'0', ct += target[y][x]-'0'; return co==ct ? "YES" : "NO"; }};