Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这样为什么还是错呀!!条件都满足了,输入多少个都没有问题,可是怎么还不行呀!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator