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:这样为什么还是错呀!!条件都满足了,输入多少个都没有问题,可是怎么还不行呀!!

Posted by 0617404001 at 2008-09-17 17:21:52 on Problem 1654
In Reply To:这样为什么还是错呀!!条件都满足了,输入多少个都没有问题,可是怎么还不行呀!! Posted by:sleepboy at 2004-10-02 13:28:17
> #include<iostream.h>
> void main()
> {
> 	char c;
> 	float result[20];
> 	int n,i;
> 	int x,y,xx,yy;
>     int ok;
> 	float area;
> 	int area1;
> 	cin>>n;
>     i=0;
> 	while(i<n){
> 		ok=0; area=0;area1=0; x=0;y=0;xx=0;yy=0;
> 		while(!ok){
>         cin>>c;
> 		switch(c){
> 			case '1' :
> 				xx=x-1;yy=y-1;break;
> 			case '2' :
> 				yy=y-1;	  break;
> 			case '3':
> 				xx=x+1;yy=y-1;break;
> 			case '4':
> 				xx=x-1;break;
> 			case '5':
> 				ok=1; break;
> 			case '6':
> 				xx=x+1;break;
> 			case '7':
> 				xx=x-1;yy=y+1;break;
> 			case '8':
> 				yy=y+1;   break;
> 			case '9':
> 				xx=x+1;yy=y+1;
> 			default:
>             	continue;
> 		}                  
> 		area1 += (yy+y)*(xx-x);
> 		x=xx;y=yy;
> 		}
> 		area = float(area1) / 2.0;
> 		area = area > 0 ? area : -area;
>         result[i++]=area;
> 	}
> 	for(i=0;i<n;i++)
> 		cout<< result[i] <<endl;
> }                    

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