当前位置:网站首页>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
边栏推荐
- Redis key value database [primary]
- 深度学习分类网络--VGGNet
- Linkage between esp8266 and stc8h8k single chip microcomputer - Weather Clock
- 从设计交付到开发,轻松畅快高效率!
- JWT工具类
- 官方零基础入门 Jetpack Compose 的中文课程来啦!
- Lambda expressions and method references
- STC8H8K系列汇编和C51实战——串口发送菜单界面选择不同功能
- Common websites for Postgraduates in data mining
- 让每一位开发者皆可使用机器学习技术
猜你喜欢
穀歌出海創業加速器報名倒計時 3 天,創業人闖關指南提前收藏!
From design delivery to development, easy and efficient!
借力 Google Cloud 基础设施和着陆区,构建企业级云原生卓越运营能力
Shenji Bailian 3.54-dichotomy of dyeing judgment
Happy Lantern Festival | Qiming cloud invites you to guess lantern riddles
ZABBIX server trap command injection vulnerability (cve-2017-2824)
来自读者们的 I/O 观后感|有奖征集获奖名单
Software testing Q & A
神机百炼3.54-染色法判定二分图
谷歌出海创业加速器报名倒计时 3 天,创业人闯关指南提前收藏!
随机推荐
Style modification of Mui bottom navigation
Stick to the big screen UI, finereport development diary
[C language] screening method for prime numbers
PHP read file (read JSON file, convert to array)
1035 Password
STC8H8K系列汇编和C51实战——按键允许按键计数(利用下降沿中断控制)
页面打印插件print.js
Regular expression summary
ESP8266与STC8H8K单片机联动——天气时钟
Problems encountered in uni app development (continuous update)
Talking about MySQL database
PHP array to XML
php读文件(读取文件内含有某字符串的指定行)
token过期自动续费方案和实现
Scheme and implementation of automatic renewal of token expiration
神机百炼3.54-染色法判定二分图
keepalived安装使用与快速入门
神机百炼3.52-Prim
深度学习分类网络--VGGNet
Can't the dist packaged by vite be opened directly in the browser