当前位置:网站首页>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
边栏推荐
- 借力 Google Cloud 基础设施和着陆区,构建企业级云原生卓越运营能力
- Vscode paste image plugin saves image path settings
- Format check JS
- php读文件(读取文件内含有某字符串的指定行)
- 社区说|Kotlin Flow 的原理与设计哲学
- From design delivery to development, easy and efficient!
- ZABBIX server trap command injection vulnerability (cve-2017-2824)
- Talking about MySQL database
- Test case
- Servlet web XML configuration details (3.0)
猜你喜欢

来自读者们的 I/O 观后感|有奖征集获奖名单

神机百炼3.53-Kruskal

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

ZABBIX server trap command injection vulnerability (cve-2017-2824)

Compte à rebours de 3 jours pour l'inscription à l'accélérateur de démarrage Google Sea, Guide de démarrage collecté à l'avance!

51单片机——ADC讲解(A/D转换、D/A转换)

Shenji Bailian 3.53-kruskal

Leverage Google cloud infrastructure and landing area to build enterprise level cloud native excellent operation capability

Little bear sect manual query and ADC in-depth study

浏览器原理思维导图
随机推荐
Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')
From design delivery to development, easy and efficient!
图片裁剪插件cropper.js
500. Keyboard line
Introduce uview into uni app
Use some common functions of hbuilderx
ZABBIX server trap command injection vulnerability (cve-2017-2824)
神机百炼3.53-Kruskal
Stc8h8k series assembly and C51 actual combat - keys allow key counting (using falling edge interrupt control)
PHP gets CPU usage, hard disk usage, and memory usage
Google Go to sea entrepreneurship accelerator registration countdown 3 days, entrepreneurs pass through the guide in advance collection!
Mock simulate the background return data with mockjs
Nacos 启动报错 Error creating bean with name ‘instanceOperatorClientImpl‘ defined in URL
Software testing Q & A
PHP extensions
Redis key value database [seckill]
我所理解的DRM显示框架
线性dp(拆分篇)
Can't the dist packaged by vite be opened directly in the browser
Verifying downloaded files using sha256 files