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

请再自己仔细查查,或者换个再简单点的题目做作,先熟悉一下系统。

Posted by hawk at 2004-10-02 13:43:46 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