Created
October 5, 2016 22:02
-
-
Save krofna/91819d9817d11f71e00a5f98815e1e07 to your computer and use it in GitHub Desktop.
This file contains 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
#include <iostream> | |
#include <cstring> | |
#include <stack> | |
using namespace std; | |
string tbl[11] = { | |
"xxxxx" | |
"x...x" | |
"x...x" | |
"x...x" | |
"x...x" | |
"x...x" | |
"xxxxx", | |
"....x" | |
"....x" | |
"....x" | |
"....x" | |
"....x" | |
"....x" | |
"....x", | |
"xxxxx" | |
"....x" | |
"....x" | |
"xxxxx" | |
"x...." | |
"x...." | |
"xxxxx", | |
"xxxxx" | |
"....x" | |
"....x" | |
"xxxxx" | |
"....x" | |
"....x" | |
"xxxxx", | |
"x...x" | |
"x...x" | |
"x...x" | |
"xxxxx" | |
"....x" | |
"....x" | |
"....x", | |
"xxxxx" | |
"x...." | |
"x...." | |
"xxxxx" | |
"....x" | |
"....x" | |
"xxxxx", | |
"xxxxx" | |
"x...." | |
"x...." | |
"xxxxx" | |
"x...x" | |
"x...x" | |
"xxxxx", | |
"xxxxx" | |
"....x" | |
"....x" | |
"....x" | |
"....x" | |
"....x" | |
"....x", | |
"xxxxx" | |
"x...x" | |
"x...x" | |
"xxxxx" | |
"x...x" | |
"x...x" | |
"xxxxx", | |
"xxxxx" | |
"x...x" | |
"x...x" | |
"xxxxx" | |
"....x" | |
"....x" | |
"xxxxx", | |
"....." | |
"..x.." | |
"..x.." | |
"xxxxx" | |
"..x.." | |
"..x.." | |
"....." }; | |
string in[7], out[7]; | |
bool Compare(int x, int i) | |
{ | |
for (int y = 0; y < 7; ++y) | |
if (memcmp(&in[y][x], &tbl[i][y * 5], 5)) | |
return false; | |
return true; | |
} | |
int Identify(int x) | |
{ | |
for (int i = 0; i < 11; ++i) | |
if (Compare(x, i)) | |
return i; | |
return -1; | |
} | |
void PrintChar(int c, bool b) | |
{ | |
for (int i = 0; i < 7; ++i) | |
{ | |
for (int j = 0; j < 5; ++j) | |
out[i].push_back(tbl[c][i * 5 + j]); | |
if (b) out[i].push_back('.'); | |
} | |
} | |
void Print(int x) | |
{ | |
stack<int> s; | |
while (x != 0) | |
{ | |
s.push(x % 10); | |
x /= 10; | |
} | |
while (!s.empty()) | |
{ | |
int c = s.top(); s.pop(); | |
PrintChar(c, !s.empty()); | |
} | |
for (int i = 0; i < 7; ++i) | |
cout << out[i] << '\n'; | |
} | |
int main() | |
{ | |
for (int i = 0; i < 7; ++i) | |
cin >> in[i]; | |
int a[2], b = 0; | |
a[0] = a[1] = 0; | |
for (int x = 0; x < in[0].size(); x += 6) | |
{ | |
int c = Identify(x); | |
if (c != 10) | |
{ | |
a[b] *= 10; | |
a[b] += c; | |
} | |
else ++b; | |
} | |
Print(a[0] + a[1]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment