Windows Of CCPC(2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛)

Problem Description
In recent years, CCPC has developed rapidly and gained a large number of competitors .One contestant designed a design called CCPC Windows .The 1-st order CCPC window is shown in the figure:



And the 2-nd order CCPC window is shown in the figure:

Windows Of CCPC(2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛)_第1张图片


We can easily find that the window of CCPC of order  k is generated by taking the window of CCPC of order k1 as C of order k, and the result of inverting C/P in the window of CCPC of order k1 as P of order k.
And now I have an order k ,please output k-order CCPC Windows , The CCPC window of order k is a 2k2k matrix.
 

 

Input
The input file contains  T test samples.(1<=T<=10)

The first line of input file is an integer T.

Then the T lines contains a positive integers k , (1k10
 

 

Output
For each test case,you should output the answer .
 

 

Windows Of CCPC(2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛)_第2张图片

 

 
 
#include 
#include 
#include 
#include 
#include <string>
#include 
#include 
#include 
#include 
#include <set>
#include 
#include 
#include 
typedef long long ll;
using namespace std;
const int INT=1e6+5;
#define lson rt<<1, l, m  
#define rson rt<<1|1, m+1, r
#define read(x) scanf("%d",&x)
#define lread(x) scanf("%lld",&x);
#define pt(x) printf("%d\n",(x))
#define cn cin>>
#define ct cout<<
#define en <#define rep(j,k) for (int i = (int)(j); i <= (int)(k); i++)
#define mem(s,t) memset(s,t,sizeof(s))
#define re return 0;
#define TLE std::ios::sync_with_stdio(false);
ll a[100000+5],b[10000+5];
priority_queueq1,q2;
int main()
{
    TLE;
    char arr[1030][1030];
    arr[0][0]='C';
    arr[0][1]='C';
    arr[1][0]='P';
    arr[1][1]='C';
    ll x;
    for(int i=1;i<=9;i++)
    {
        x=(1<<i);
        //ct x en;
        for(int j=0;j)
        {
            for(int k=0;k)
            {
                arr[j][k+x]=arr[j][k];
            }
        }

        for(int j=x;j2;j++)
        {
            for(int k=x;k2;k++)
            {
                arr[j][k]=arr[j-x][k];
            }
        }

        for(int j=0;j)
        {
            for(int k=0;k)
            {
                arr[j+x][k]=arr[j][k]=='P'?'C':'P';
            }
        }
    }
    int t,k;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&k);
        x=(1<<k);
        for(int i=0;i)
        {
            for(int j=0;j)
            {
                printf("%c",arr[i][j]);
            }
            printf("\n");
        }
    }


}

 

你可能感兴趣的:(Windows Of CCPC(2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛))