#include<stdio.h>
#include<string.h>
char d[25][25],b[100][5];
int e[25][25];
int main()
{
int r,c,t,k=0;
scanf("%d%d",&r,&c);
getchar();
char a[100];
gets(a);
int len=strlen(a),i,j;
for(i=0;i<len;i++)
{
if(a[i]==' ')
t=0;
else t=a[i]-'A'+1;
for(j=4;j>=0;j--)
{
b[i][j]=t%2+'0';
t=t/2;
}
}
int x=0,y=0,count=0;
j=0;
i=0;
while(count<len*5)
{
while(y<c&&e[x][y]!=1&&count<len*5)
{
d[x][y++]=b[i][j++];
e[x][y-1]=1;
count++;
if(j==5)
{
i++;
j=0;
}
}
y--;
x++;
while(x<r&&e[x][y]!=1&&count<len*5)
{
d[x++][y]=b[i][j++];
e[x-1][y]=1;
count++;
if(j==5)
{
i++;
j=0;
}
}
x--;
y--;
while(y>=0&&e[x][y]!=1&&count<len*5)
{
d[x][y--]=b[i][j++];
b[x][y+1]=1;
count++;
if(j==5)
{
i++;
j=0;
}
}
y++;
x--;
while(x>=0&&e[x][y]!=1&&count<len*5)
{
d[x--][y]=b[i][j++];
b[x+1][y]=1;
count++;
if(j==5)
{
i++;
j=0;
}
}
x++;
y++;
}
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
if(d[i][j]==NULL)
printf("0");
else printf("%c",d[i][j]);
}
return 0;
}
运行时为什么会出现方框□
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
悬赏问题
- ¥20 软件测试决策法疑问求解答
- ¥15 win11 23H2删除推荐的项目,支持注册表等
- ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
- ¥15 qt6.6.3 基于百度云的语音识别 不会改
- ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
- ¥15 神经网络怎么把隐含层变量融合到损失函数中?
- ¥15 lingo18勾选global solver求解使用的算法
- ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
- ¥20 测距传感器数据手册i2c
- ¥15 RPA正常跑,cmd输入cookies跑不出来