当前位置:网站首页>Contest3147 - game 38 of 2021 Freshmen's personal training match_ G: Flower bed
Contest3147 - game 38 of 2021 Freshmen's personal training match_ G: Flower bed
2022-07-02 06:06:00 【This question AC sleep again】




//
#include<bits/stdc++.h>
using namespace std;
// 1 ≤ n ≤ 1000
const int MAXN=2222;
char str[MAXN],ans[MAXN][MAXN]; // An array type
void init()
{
memset( str,0,sizeof( str ) );
memset( ans,0,sizeof( ans ) );
}
int main()
{
int n,i,j,p1,p2,cnt; init();
while( ~scanf("%d%s",&n,str) )
{
p1=1; p2=2*n-1; cnt=0;
while( p1<=p2 )
{
for( i=p1;i<=p2;i++ ) ans[i][p1]=ans[i][p2]=str[cnt];
for( j=p1;j<=p2;j++ ) ans[p1][j]=ans[p2][j]=str[cnt];
p1++; p2--; cnt++; // One step is enough for both sides
}
for( i=1;i<=2*n-1;i++ ) // ans[0][j] No data Out-of-service %s
{
for( j=1;j<=2*n-1;j++ )
{
printf("%c",ans[i][j]);
}
printf("\n");
}
init();
}
return 0;
}//
find:
01 It's complicated at first Make good use of while for Two cycles
p1=1 ++
p2=2*n-1 --
[p1][p1]~[p1][p2]
[p1][p1]~[p2][p1]
... ...
02 ans[0][j] No data Out-of-service %s
03 Be careful init(); The impact of location on data
04 data type char Check ( With a few Unskilled )
05 n<=1000 2*n-1 Be careful of spillage
边栏推荐
- php数组转化为xml
- Lambda expressions and method references
- 官方零基础入门 Jetpack Compose 的中文课程来啦!
- Can't the dist packaged by vite be opened directly in the browser
- Mock simulate the background return data with mockjs
- How vite is compatible with lower version browsers
- php内类名称与类内方法名相同
- Several keywords in C language
- 谷歌出海创业加速器报名倒计时 3 天,创业人闯关指南提前收藏!
- AttributeError: ‘str‘ object has no attribute ‘decode‘
猜你喜欢

浏览器原理思维导图

复杂 json数据 js前台解析 详细步骤《案例:一》

脑与认知神经科学Matlab Psytoolbox认知科学实验设计——实验设计四

Google Go to sea entrepreneurship accelerator registration countdown 3 days, entrepreneurs pass through the guide in advance collection!

Step by step | help you easily submit Google play data security form

网络相关知识(硬件工程师)

Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')

Ti millimeter wave radar learning (I)

Community theory | kotlin flow's principle and design philosophy

经典文献阅读之--Deformable DETR
随机推荐
神机百炼3.52-Prim
Common websites for Postgraduates in data mining
ZABBIX server trap command injection vulnerability (cve-2017-2824)
【C语言】简单实现扫雷游戏
Spark概述
Leverage Google cloud infrastructure and landing area to build enterprise level cloud native excellent operation capability
Jetpack Compose 与 Material You 常见问题解答
深度学习分类网络--VGGNet
uni-app开发中遇到的问题(持续更新)
php父类(parent)
php读文件(读取json文件,转换为数组)
Summary of MySQL constraints
Detailed notes of ES6
线性dp(拆分篇)
492. Construction rectangle
Frequently asked questions about jetpack compose and material you
php内的addChild()、addAttribute()函数
Zabbix Server trapper 命令注入漏洞 (CVE-2017-2824)
Redis Key-Value数据库 【高级】
JWT工具类