当前位置:网站首页>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
边栏推荐
- How to use mitmproxy
- Frequently asked questions about jetpack compose and material you
- 穀歌出海創業加速器報名倒計時 3 天,創業人闖關指南提前收藏!
- ROS2----LifecycleNode生命周期节点总结
- 如何使用MITMPROXy
- php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
- Mathematical statistics and machine learning
- PHP read file (read the specified line containing a string in the file)
- Detailed steps of JS foreground parsing of complex JSON data "case: I"
- Let every developer use machine learning technology
猜你喜欢

PHP development and testing WebService (soap) -win

让每一位开发者皆可使用机器学习技术

PHP 开发与测试 Webservice(SOAP)-Win

uni-app开发中遇到的问题(持续更新)

经典文献阅读之--SuMa++

步骤详解 | 助您轻松提交 Google Play 数据安全表单

Unity Shader 学习笔记(3)URP渲染管线带阴影PBR-Shader模板(ASE优化版本)

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

Can't the dist packaged by vite be opened directly in the browser

Ros2 --- lifecycle node summary
随机推荐
Redis key value database [advanced]
Web page user step-by-step operation guide plug-in driver js
Error creating bean with name 'instanceoperatorclientimpl' defined in URL when Nacos starts
From design delivery to development, easy and efficient!
Memcached installation
Eco express micro engine system has supported one click deployment to cloud hosting
【C语言】筛选法求素数
php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
Shenji Bailian 3.54-dichotomy of dyeing judgment
Redis key value database [primary]
Keepalived installation, use and quick start
借力 Google Cloud 基础设施和着陆区,构建企业级云原生卓越运营能力
php内的addChild()、addAttribute()函数
PHP parent
MUI底部导航的样式修改
Community theory | kotlin flow's principle and design philosophy
Happy Lantern Festival | Qiming cloud invites you to guess lantern riddles
Use some common functions of hbuilderx
浏览器原理思维导图
Redis Key-Value数据库 【秒杀】