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 |
runtimes 错误是为什么??#include <iostream> #include <math.h> #include <stdio.h> using namespace std; class _point{ public: _point(); __int64 x,y; }; _point::_point(){ ding=1;x=0;y=0;} main(){ int line; char c; cin>>line; _point* points=new _point[10000]; for (int ctr=0;ctr<line;ctr++){ int i=0,x=0,y=0,times=0; double area=0.0; while ((c=getchar())!='5'){ times++;i++; switch(c){ case '1': x--;y++;break; case '2': y++;break; case '3': x++;y++;break; case '4': x--;break; case '6': x++;break; case '7': x--;y--;break; case '8': y--;break; case '9': x++;y--;break; } points[i].x=x;points[i].y=y; if ((points[i-2].x+points[i].x)/2.0==points[i-1].x&&(points[i].y+points[i-2].y)/2==points[i-1].y); } if (points[times].x!=0&&points[times].y!=0) cout<<"0"<<endl; else {//int x=0,y=0; times--; area+=points[times].x*points[0].y-points[0].x*points[times].y; for (int ctr=0;ctr<times;ctr++){ area+=points[ctr].x*points[ctr+1].y-points[ctr+1].x*points[ctr].y; } area/=2.0; area=abs(area); cout<<area<<endl; } delete points; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator