weird,my program keeps "running",but it doesn't get TLE,please help me,tell me what's the matter
i submit my program,but the status is always "running"
now i have no idea about it,maybe something is wrong with the judge?
here is my program:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
int x=0,y=0,z=0;
void eliminate_x(){
y+=x,z-=x,x=0;
}
void eliminate_y(){
x+=y,z+=y,y=0;
}
void eliminate_z(){
x-=z,y+=z,z=0;
}
int main()
{
int i,n,step,type=0,min,m;
char c;
//freopen("test.in","r",stdin);
scanf("%d",&n);
for(i=0;i<n;i++){
c=0;
while(!isalpha(c)) c=getchar();
scanf("%d",&step);
if (c=='X') x+=step;
else if (c=='Y') y+=step;
else if (c=='Z') x-=step,y+=step;
}
min=abs(x)+abs(y);
eliminate_x();
if (abs(y)+abs(z)<min) min=abs(y)+abs(z),type=1;
eliminate_y();
if (abs(x)+abs(z)<min) min=abs(x)+abs(z),type=2;
m=0;
if (type==0){
eliminate_z();
if (!x) m++;
if (!y) m++;
printf("%d\n",m);
if (x) printf("X %d\n",-x);
if (y) printf("Y %d\n",-y);
}else if (type==1){
eliminate_x();
if (!y) m++;
if (!z) m++;
printf("%d\n",m);
if (y) printf("Y %d\n",-y);
if (z) printf("Z %d\n",-z);
}else{
if (!x) m++;
if (!z) m++;
printf("%d\n",m);
if (x) printf("X %d\n",-x);
if (z) printf("Z %d\n",-z);
}
return 0;
}
Re: weird,my program keeps "running",but it doesn't get TLE,please help me,tell me what's the matter
if wait a little more (at last 1day) you will find your result. don`t
submit it again...
Yours
Aidin
Re: weird,my program keeps "running",but it doesn't get TLE,please help me,tell me what's the matter
Yeah... And my program keep running. I submit it before 12
hours !!!! :))))
How many tests there is for this problem ? :))