Replies: 0 comments 3 replies
-
我采用的方法是先排版后打印,有两个测试点错误,找不到原因?求指点,代码如下: #include<stdio.h>
int main()
{
int N,row;
char a[11][21];
char c;
scanf("%d %c\n",&N,&c);
if(row%2==0) row=N/2;
else row=N/2+1;
for(int j=0;j<=N-1;j++)
{
a[0][j]=c;
a[row-1][j]=c;
}
for(int i=1;i<=row-2;i++)
{
a[i][0]=c;
a[i][N-1]=c;
}
for(int i=1;i<=row-2;i++)
for(int j=1;j<=N-2;j++)
a[i][j]=' ';
for(int i=0;i<row;i++){
for(int j=0;j<N;j++)
{
printf("%c",a[i][j]);
}
printf("\n");
}
return 0;
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
第一个看到的,这个 |
Beta Was this translation helpful? Give feedback.
0 replies
-
谢谢指点,经改正答案已完全正确,代码高亮和排版下次我会注意的。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://oliverlew.github.io/PAT/Basic/1036.html
题目
Beta Was this translation helpful? Give feedback.
All reactions