Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么老是WA?在本地运行是正确的呀,各位帮帮忙

Posted by lzpsky at 2007-01-23 17:55:06 on Problem 1102
In Reply To:为什么老是WA?在本地运行是正确的呀,各位帮帮忙 Posted by:lzpsky at 2007-01-23 17:01:47
> #include<stdio.h>
> #define MAX 1000
> main()
> {
> 	int n[MAX],s[MAX],count,i=0,j,k,t,h,m[9];
> 	while(1){
> 		scanf("%d%d",&s[i],&n[i]);
> 		if(n[i]==0&&s[i]==0) break;
> 		if(n[i]>=0&&n[i]<=99999999&&s[i]>=1&&s[i]<=10)
> 			i++;			
> 	}
> 	
>     count=i;
>     for(i=0;i<count;i++)
> 	{
> 		for(j=0;n[i]!=0;j++)
> 		{
> 			m[j]=n[i]%10;
> 			n[i]=n[i]/10;
> 		}
>      
> 		for(k=j-1;k>=0;k--)
> 		{
> 			if(m[k]!=1&&m[k]!=4)
> 			{
> 				printf(" ");
> 				for(t=0;t<s[i];t++)
> 					printf("-");
> 				printf(" ");
> 			}
> 			else 
> 				for(t=0;t<s[i]+2;t++)
> 					printf(" ");
> 			    printf(" ");
> 		}
> 		printf("\n");
> 
> 	   for(t=0;t<s[i];t++)
> 		{
> 			for(k=j-1;k>=0;k--)
> 			{			
> 				if(m[k]==5||m[k]==6)
> 				{
> 					printf("|");
> 				    for(h=0;h<s[i]+1;h++)
> 					    printf(" ");
> 				}
> 				else if(m[k]==1||m[k]==2||m[k]==3||m[k]==7)
> 				{
> 					for(h=0;h<s[i]+1;h++)
> 					    printf(" ");
> 					printf("|");
> 				}
> 				else
> 				{
> 					printf("|");
> 					for(h=0;h<s[i];h++)
> 						printf(" ");
> 					printf("|");
> 				}
> 			    	printf(" ");
> 			}
> 			printf("\n");
> 		}
> 	   
> 
> 		for(k=j-1;k>=0;k--)
> 		{
> 			if(m[k]==1||m[k]==7||m[k]==0)
> 			{
> 				for(t=0;t<s[i]+2;t++)
> 					printf(" ");
> 			}
> 			else
> 			{
> 				printf(" ");
> 				for(t=0;t<s[i];t++)
> 					printf("-");
> 				printf(" ");
> 			}
> 			    printf(" ");
> 		}
> 		printf("\n");
> 
> 		for(t=0;t<s[i];t++)
> 		{
> 			for(k=j-1;k>=0;k--)
> 			{			
> 				if(m[k]==2)
> 				{
> 					printf("|");
> 				    for(h=0;h<s[i]+1;h++)
> 					    printf(" ");
> 				}
> 				else if(m[k]==0||m[k]==6||m[k]==8)
> 				{
> 					printf("|");
> 					for(h=0;h<s[i];h++)
> 					    printf(" ");
> 					printf("|");
> 				}
> 				else
> 				{					
> 					for(h=0;h<s[i]+1;h++)
> 						printf(" ");
> 					printf("|");
> 				}
> 				if(k>0)
> 				    printf(" ");
> 			}
> 			printf("\n");
> 		}
> 		
> 
> 		for(k=j-1;k>=0;k--)
> 		{
> 			if(m[k]==1||m[k]==4||m[k]==7)
> 			{
> 				for(t=0;t<s[i]+2;t++)
> 					printf(" ");
> 			}
> 			else
> 			{
> 				printf(" ");
> 				for(t=0;t<s[i];t++)
> 					printf("-");
> 				printf(" ");
> 			}
> 			    printf(" ");
> 		}
> 		printf("\n");
> 		printf("\n");
> 	}
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator