题目链接:传送门

有年代的代码
好久之前写的了
比较
麻烦
改码风改了好久
长度好像都溢出了…
自动换行了
反正我的atom是这样的

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <algorithm>
#include <climits>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define A 1000010
#define B 2010

using namespace std;
typedef long long ll;
string ss[100][100] = {
{"xxxxx", "....x", "xxxxx", "xxxxx", "x...x", "xxxxx", "xxxxx", "xxxxx", "xxxxx", "xxxxx"},
{"x...x", "....x", "....x", "....x", "x...x", "x....", "x....", "....x", "x...x", "x...x"},
{"x...x", "....x", "....x", "....x", "x...x", "x....", "x....", "....x", "x...x", "x...x"},
{"x...x", "....x", "xxxxx", "xxxxx", "xxxxx", "xxxxx", "xxxxx", "....x", "xxxxx", "xxxxx"},
{"x...x", "....x", "x....", "....x", "....x", "....x", "x...x", "....x", "x...x", "....x"},
{"x...x", "....x", "x....", "....x", "....x", "....x", "x...x", "....x", "x...x", "....x"},
{"xxxxx", "....x", "xxxxx", "xxxxx", "....x", "xxxxx", "xxxxx", "....x", "xxxxx", "xxxxx"}};
char m[B][B];
int w[100010], r[100010];
string s[10];
ll len, ans1, ans2, ans, cntt, xa, cnt, ew, num1, num2, type;

int main(int argc, char const *argv[]) {
    for (int i = 0; i < 7; i++) {
        cin >> s[i];
        len = s[i].length();
        for (int j = 0; j < len; j++) m[i][j] = s[i][j];
    }
    cnt = len / 6 + 1;
    for (ll k = 1; k <= cnt; k++) {
        for (int i = 0, we = 0; we < 5; we++)
            for (int j = ew; j < ew + 5; j++) {
                if (m[i + 1][j + 2] == 'x' and m[i + 2][j + 2] == 'x' and m[i + 3][j] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 3] == 'x' and m[i +3 ][j + 4] == 'x' and m[i + 4][j + 2] == 'x' and m[i + 5][j + 2] == 'x')	{type = 1; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j] == 'x' and m[i + 2][j] == 'x' and m[i + 3][j] == 'x' and m[i + 4][j] == 'x' and m[i + 5][j] == 'x' and m[i + 6][j] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 3] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j + 2] == 'x' and m[i +6 ][j +3 ] == 'x')
                  if (!type) {w[num1++] = 8; goto portal;}
                  else {r[num2++] = 8; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j] == 'x' and m[i + 2][j] == 'x' and m[i + 3][j] == 'x' and m[i + 4][j] == 'x' and m[i + 5][j] == 'x' and m[i + 6][j] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j + 2] == 'x' and m[i +6 ][j + 3] == 'x')
                  if (!type) {w[num1++] = 0; goto portal;}
                  else {r[num2++] = 0; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j] == 'x' and m[i + 2][j] == 'x' and m[i + 3][j] == 'x' and m[i + 6][j] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 3] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j + 2] == 'x' and m[i + 6][j + 3] == 'x')
                  if (!type) {w[num1++] = 9; goto portal;}
                  else {r[num2++] = 9; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 3][j + 3] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x' and m[i + 6][j + 3] == 'x' and m[i + 6][j + 2] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j] == 'x')
                  if (!type) {w[num1++] = 3; goto portal;}
                  else {r[num2++] = 3; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 3][j + 3] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j] == 'x' and m[i + 4][j] == 'x' and m[i + 5][j] == 'x' and m[i + 6][j] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j + 2] == 'x' and m[i + 6][j + 3] == 'x' and m[i +6 ][j + 4] == 'x')
                  if (!type) {w[num1++] = 2;goto portal;}
                  else {r[num2++]=2; goto portal;}
                else if (m[i][j] == 'x' and m[i + 1][j] == 'x' and m[i + 2][j] == 'x' and m[i + 3][j] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 3] == 'x' and m[i + 3][j + 4] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 4][j + 4]  == 'x' and m[i + 5][j +4] == 'x' and m[i + 6][j + 4] == 'x')
                  if (!type) {w[num1++] = 4; goto portal;}
                  else {r[num2++] = 4; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x')
                  if (!type) {w[num1++] = 7; goto portal;}
                  else {r[num2++] = 7; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j] == 'x' and m[i + 2][j] == 'x' and m[i + 3][j] == 'x' and m[i + 4][j] == 'x' and m[i + 5][j]  == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j + 2] == 'x' and m[i +3][j + 3] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x' and m[i + 6][j] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j + 2] == 'x' and m[i + 6][j + 3] == 'x')
                  if (!type) {w[num1++] = 6; goto portal;}
                  else {r[num2++] = 6; goto portal;}
                else if (m[i][j] == 'x' and m[i][j + 1] == 'x' and m[i][j + 2] == 'x' and m[i][j + 3] == 'x' and m[i][j + 4] == 'x' and m[i + 1][j] == 'x' and m[i + 2][j] == 'x' and m[i + 3][j] == 'x' and m[i + 3][j + 1] == 'x' and m[i + 3][j + 2] == 'x' and m[i + 3][j + 3] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x' and m[i + 6][j] == 'x' and m[i + 6][j + 1] == 'x' and m[i + 6][j + 2] == 'x' and m[i + 6][j + 3] == 'x')
                  if (!type) {w[num1++] = 5; goto portal;}
                  else {r[num2++] = 5; goto portal;}
                else if (m[i][j + 4] == 'x' and m[i + 1][j + 4] == 'x' and m[i + 2][j + 4] == 'x' and m[i + 3][j + 4] == 'x' and m[i + 4][j + 4] == 'x' and m[i + 5][j + 4] == 'x' and m[i + 6][j + 4] == 'x')
                  {if (!type) {w[num1++] = 1; goto portal;}
                  else {r[num2++] = 1; goto portal;}}
            }
        portal:	ew += 6;
    }
    for (int i = 0; i < num1; i++) ans1 += w[i] * (ll)pow(10LL, num1 - i - 1);
    for (int i = 0; i < num2; i++) ans2 += r[i] * (ll)pow(10LL, num2 - i - 1);
    ans = ans1 + ans2; xa = ans;
    while (xa) { cntt++; xa /= 10LL;}
    for (int k = 0; k < 7; k++) {
        for (int i = 1; i < cntt; i++) cout << ss[k][ans / (ll)(pow(10LL, cntt - i)) % 10LL] << ".";
        cout << ss[k][ans % 10] << endl;
    }
    return 0;
}
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐