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

runtimes 错误是为什么??

Posted by gohan at 2006-01-28 10:46:06 on Problem 1654
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

class _point{

public:
  _point();
  __int64 x,y;
  double ding;


};
_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)
  points[i-1].ding=0;
  }
  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:
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