4009 WA

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Post Reply
Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

4009 WA

Post by Obaida »

Some one help me to get Accepted. I got WA in this problem.

Code: Select all

#include<stdio.h>
int main()
{
	int i,j,k,r,c,end;
	char arr[409],st[21][21];
	while(scanf("%d %d",&r,&c)==2&&r!=0&&c!=0)
	{
		getchar();
		gets(arr);
		k=0;
		for(i=0;i<r;i++)
		{
			for(j=0;j<c;j++)
			{
				st[i][j]=arr[k];
				k++;
			}
		}
		k=0;
		if(c%2==0)
			end=c/2-1;
		else
			end=c/2;
		while(k<=end)
		{
			for(i=k;i<c-k;i++)
				printf("%c",st[k][i]-7);
			for(i=k+1;i<r-k;i++)
				printf("%c",st[i][c-(k+1)]-7);
			for(i=c-(k+2);i>=k;i--)
				printf("%c",st[r-(k+1)][i]-7);
			for(i=r-(k+2);i>k;i--)
				printf("%c",st[i][k]-7);
			k++;
		}
		puts("");
	}
	return 0;
}
try_try_try_try_&&&_try@try.com
This may be the address of success.
Post Reply

Return to “ACM ICPC Archive Board”