windows of ccpc
#include <stdio.h>
#include <math.h>
void f(int n, int s, int t)
{
if(n==2)
{
if(t==1) {
if(s==1)
printf("CC");
else printf("PC");
}
else {
if(s==1)
printf("PP");
else printf("CP");
}
return ;
}
int x=s%(n/2);
if(x==0)
x=n/2;
if(t==1)
{
if(s>n*1.0/2)
f(n/2, x, 0);
else f(n/2, x, 1);
f(n/2, x, 1);
}
else if(t==0){
if(s>n*1.0/2)
f(n/2, x, 1);
else f(n/2, x, 0);
f(n/2, x, 0);
}
}
int main()
{
int t, n;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
n=pow(2, n);
for(int i=1; i<=n; i++) {
f(n, i, 1);
printf("\n");
}
}
return 0;
}
#include<iostream>
#include<math.h>
using namespace std;
char map[1050][1050];
void init(){
map[1][1]='C';
map[1][2]='C';
map[2][1]='P';
map[2][2]='C';
int i,j,k;
for(i=2;i<=10;i++){
int left = pow(2,i-1);
int right = pow(2,i);
for(j=1;j<=left;j++){
for(k=left+1;k<=right;k++){
map[j][k]=map[j][k-left];
map[j+left][k]=map[j][k-left];
}
for(j=left+1;j<=right;j++){
for(k=1;k<=left;k++){
map[j][k]=(map[j-left][k]=='C')?'P':'C';
}
}
}
}
return;
}
int main(){
int T;
cin>>T;
init();
while(T--){
int s,i,j;
cin>>s;
int len=pow(2,s);
for(i=1;i<=len;i++){
for(j=1;j<=len;j++){
cout<<map[i][j];
}
cout<<endl;
}
}
return 0;
}
相關文章
- 2017 CCPC Qinhuangdao Site
- CCPC2023-Shenzhen
- 2018CCPC秦皇島站總結
- 9月20日CCPC賽後反思與總結
- 2020CCPC長春題解 I - Kawaii CourierAI
- 2022 China Collegiate Programming Contest (CCPC) Guilin SiteGUI
- EC-Final 2023 & CCPC Final 2023 遊記
- 2022CCPC綿陽-E-一類圖上DP最佳化
- 除了ACM、CCPC......2021Datathon數智馬拉松大賽也來了!帶著數十萬獎金!ACM
- 2018天梯賽、藍橋杯、(CCPC省賽、邀請賽、ICPC邀請賽)校內選拔賽反思總結!
- Windows API 之 Windows ServiceWindowsAPI
- Windows (wince、 windows mobile、windows phone)錯誤程式碼大全Windows
- Windows 10 終於幹掉了 Windows 7!Windows
- 微軟釋出Windows 10 Windows Defender中心微軟Windows
- windows server 注意windows的temp目錄WindowsServer
- getopt for windowsWindows
- Windows技巧Windows
- Memcache for WindowsWindows
- Redis for WindowsRedisWindows
- Windows核心Windows
- WINDOWS NTWindows
- Windows命令Windows
- dd for windowsWindows
- Windows terminal 好用的 Windows 命令列工具Windows命令列
- windows 安裝 scoop 命令 (windows 中的 brew)WindowsOOP
- 【Node.js】windows安裝nvm-windowsNode.jsWindows
- windows11怎麼退回windows10 windows11超過10天怎麼重灌回windows10Windows
- Windows Internet Explorer 8 for Windows Vista 和 Windows Server 2008WindowsServer
- windows核心程式設計--windows程式的執行Windows程式設計
- Windows原理深入學習系列-Windows核心提權Windows
- Windows 10丟掉了哪些糟糕的Windows 8功能?Windows
- zt WMI Windows Management Instrumentation,Windows 管理規範Windows
- Essential Windows Workflow Foundation(Windows 開發流程基礎Windows
- Windows 神器:CmderWindows
- Windows sc命令Windows
- windows10Windows
- 深入Windows APCWindows
- 建立windows serviceWindows