Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long lli;
- const int N = 10;
- const int PB = 1e9 + 7;
- vector<string> ex[10];
- map<lli, char> mp;
- char str[N][3][3];
- lli inpNumber(int len){
- for(int i = 0; i < 3; ++i){
- for(int j = 0; j < len; ++j){
- for(int k = 0; k < 3; ++k){
- scanf("%c", &str[j][i][k]);
- }
- scanf("%*c");
- }
- }
- string a;
- for(int i = 0; i < len; ++i){
- lli hsh = 0;
- for(int j = 0; j < 3; ++j){
- for(int k = 0; k < 3; ++k){
- hsh *= PB;
- hsh += str[i][j][k];
- }
- }
- a += mp[hsh];
- }
- return stol(a);
- }
- int main(){
- ex[0] = {" _ ", "| |", "|_|"};
- ex[1] = {" ", " |", " |"};
- ex[2] = {" _ ", " _|", "|_ "};
- ex[3] = {" _ ", " _|", " _|"};
- ex[4] = {" ", "|_|", " |"};
- ex[5] = {" _ ", "|_ ", " _|"};
- ex[6] = {" _ ", "|_ ", "|_|"};
- ex[7] = {" _ ", " |", " |"};
- ex[8] = {" _ ", "|_|", "|_|"};
- ex[9] = {" _ ", "|_|", " _|"};
- for(int i = 0; i < 10; ++i){
- lli hsh = 0;
- for(int j = 0; j < 3; ++j){
- for(int k = 0; k < 3; ++k){
- hsh *= PB;
- hsh += ex[i][j][k];
- }
- }
- mp[hsh] = '0' + i;
- }
- int lenA, lenB;
- scanf("%d%d%*c", &lenA, &lenB);
- lli a = inpNumber(lenA);
- lli b = inpNumber(lenB);
- cout << a + b;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement