当前位置:网站首页>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
边栏推荐
- 500. 键盘行
- Shenji Bailian 3.53-kruskal
- Mathematical statistics and machine learning
- 使用HBuilderX的一些常用功能
- mock-用mockjs模拟后台返回数据
- External interrupts cannot be accessed. Just delete the code and restore it Record this unexpected bug
- php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
- 页面打印插件print.js
- 51单片机——ADC讲解(A/D转换、D/A转换)
- 如何使用MITMPROXy
猜你喜欢

500. Keyboard line

ESP8266与STC8H8K单片机联动——天气时钟

穀歌出海創業加速器報名倒計時 3 天,創業人闖關指南提前收藏!

Software testing - concept

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

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

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

经典文献阅读之--Deformable DETR

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

从设计交付到开发,轻松畅快高效率!
随机推荐
1035 Password
php内类名称与类内方法名相同
ESP8266与STC8H8K单片机联动——天气时钟
Some descriptions of Mipi protocol of LCD
492.构造矩形
PHP read file (read JSON file, convert to array)
How vite is compatible with lower version browsers
格式校验js
【C语言】简单实现扫雷游戏
Unity Shader 学习笔记(3)URP渲染管线带阴影PBR-Shader模板(ASE优化版本)
让每一位开发者皆可使用机器学习技术
memcached安装
Redis Key-Value数据库 【高级】
Shenji Bailian 3.52-prim
php继承(extends)
ZABBIX server trap command injection vulnerability (cve-2017-2824)
Software testing - concept
Servlet web XML configuration details (3.0)
Mathematical statistics and machine learning
51单片机——ADC讲解(A/D转换、D/A转换)