设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 数据 创业者 手机
当前位置: 首页 > 服务器 > 系统 > 正文

Windows Of CCPC

发布时间:2021-02-19 05:43 所属栏目:52 来源:网络整理
导读: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 windo

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:

Windows Of CCPC



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

Windows Of CCPC



We can easily find that the window of CCPC of order? k?is generated by taking the window of CCPC of order?k?1?as?C?of order k,and the result of inverting?C/P?in the window of CCPC of order?k?1?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?2k?2k?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,(1≤k≤10)?
?

?

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

?

Windows Of CCPC

?

? ?
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
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 <<endl
#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_queue<ll>q1,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<x;j++)
        {
            for(int k=0;k<x;k++)
            {
                arr[j][k+x]=arr[j][k];
            }
        }

        for(int j=x;j<x*2;j++)
        {
            for(int k=x;k<x*2;k++)
            {
                arr[j][k]=arr[j-x][k];
            }
        }

        for(int j=0;j<x;j++)
        {
            for(int k=0;k<x;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<x;i++)
        {
            for(int j=0;j<x;j++)
            {
                printf("%c",arr[i][j]);
            }
            printf("\n");
        }
    }


}

(编辑:ASP站长网)

    网友评论
    推荐文章
      热点阅读