//选择题浪费的时间太多,编程部分一直在抠边界没有做完编程题只AC了第二题,第一题记了题目查了一下答案;
//2.有一个N*N的矩阵,将其顺时针旋转90°,要求原地改变,不使用额外空间。
//测试样例:
//输入:{{1,2,3},{4,5,6},{7,8,9},3}
//返回:{{7,4,1},{8,5,2},{9,6,3}}
//思路:转圈打印,从外至内,只需要一个额外变量即可。
vector<vector<int> > transformImage(vector<vector<int> > mat, int n) {
    // write code here
    for (int i = 0; i < n / 2;i++)
    {
        for (int j = i; j<n - 1 - i; j++)
        {
            int temp = mat[i][j];
            mat[i][j] = mat[n - 1 - j][i];
            mat[n - 1 - j][i] = mat[n - 1 - i][n - 1 - j];
            mat[n - 1 - i][n - 1 - j] = mat[j][n - 1 - i];
            mat[j][n - 1 - i] = temp;
        }
    }
    return mat;
}
//1. 五子棋:(牛客原题可搜)输入有多组数据,每组数据为一张20x20的棋盘。
//其中黑子用“*”表示,白子用“+”表示,空白位置用“.”表示。 如果棋盘上存在五子连珠(无论哪种颜色的棋子),输入“Yes”,否则输出“No”。
#include<bits/stdc++.h>
using namespace std;
 
int main(int argc, char** argv)
{
    vector<vector<char>> checkBoard(20, vector<char>(20));
 
    char c;
    while ((c = getchar()) != EOF)
    {
        ungetc(c,stdin);
        for (int i = 0; i < 20; ++i)
        {
            for (int j = 0; j < 20; ++j)
            {
                c = getchar();
                checkBoard[i][j] = c;
            }
            getchar();
        }
 
        bool found = false;
        for (int i = 0; i < 20; ++i)
        {
            if (found) break;
            for (int j = 0; j < 20; ++j)
            {
                if (checkBoard[i][j] == '.') continue;
                c = checkBoard[i][j];
                checkBoard[i][j] = '.';
                int curCount = 1;
                int x = i + 1;
                while (x < 20 && checkBoard[x][j] == c)
                {
                    checkBoard[x][j] = '.';
                    ++curCount;
                    ++x;
                }
                if (curCount >= 5)
                {
                    found = true;
                    break;
                }
                curCount = 1;
                int y = j + 1;
                while (y < 20 && checkBoard[i][y] == c)
                {
                    checkBoard[i][y] = '.';
                    ++curCount;
                    ++y;
                }
                if (curCount >= 5)
                {
                    found = true;
                    break;
                }
                curCount = 1;
                x = i + 1, y = j + 1;
                while (x < 20 && y < 20 && checkBoard[x][y] == c)
                {
                    checkBoard[x][y] = '.';
                    ++curCount;
                    ++x; ++y;
                }
                if (curCount >= 5)
                {
                    found = true;
                    break;
                }
            }
        }
 
        if (found) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
 
    return 0;
}
#远景能源有限公司##秋招##题解#