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

为什么是Run Time Error? 在我机上没有死循环阿?

Posted by xuezaiyue at 2004-07-19 23:53:29 on Problem 1654
我的代码:


#include <stdio.h>

main()
{


int t,tt;
char *a;
int x,y,xx,yy;
int area;
float area2;
int j;

scanf("%d",&tt);
getchar();




for(t=0;t<tt;t++)
{


gets(a);


x=0,y=0;
j=0;

area=0;

while(1)
{
if(a[j]=='5') break;
else if(a[j]=='8') {xx=x; yy=y+1;}
else if(a[j]=='2') {xx=x; yy=y-1;}
else if(a[j]=='6') {xx=x+1; yy=y;}
else if(a[j]=='4') {xx=x-1; yy=y;}
else if(a[j]=='9') {xx=x+1; yy=y+1;}
else if(a[j]=='7') {xx=x-1; yy=y+1;}
else if(a[j]=='3') {xx=x+1; yy=y-1;}
else if(a[j]=='1') {xx=x-1; yy=y-1;}
else break;
j++;
area=area+x*yy-xx*y;
x=xx,y=yy;
}

if(area<0) area=area*(-1);


area2=(float)area/2;
if(area2==(float)((int)(area/2)))
printf("%.0f\n",area2);
else
printf("%.1f\n",area2);


}


}



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