ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1299. Psylonians

I got WA on 23-th test!!!
Posted by Roibu Yulian 7 Dec 2013 20:36
Can somebody help me?
I don't know what to do. I tried a lot of tests and all answers were correct.
My code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
int main()
{
long a, b, x, y, z, p, q;
char ch;
scanf("%d%d", &a, &b);
scanf("%s", &ch);
scanf("%d%d%d", &x, &y, &z);
a=min(a, 100);
if(ch=='A') scanf("%d%d", &p, &q);
if(ch=='P') scanf("%d", &p);
if(ch=='P') if(x>0) ch='D';
else
{
if((abs(p)>20)&&(abs(p)<160)){
if(((p>20)&&(p<=(90)))||((p<=-90)&&(p>-160)))
printf("LEFT %d", a);
else printf("RIGHT %d", a);
}
else if(abs(p)<=20) printf("FRONT %d", a);
else printf("BACKWARD %d", a);
}
if(ch=='D') if((x>0)&&((x*20)>=b))
if(abs(z)<5) printf("FIRE %d", min(20, b));
else printf("BACKWARD %d", a);
else ch='G';
if(ch=='G') {
if(x==0) printf("STOP");
else {
if(abs(z)<5) printf("FIRE %d", min(20, b));
if(z>=5) printf("LEFT %d", a);
if(z<=-5) printf("RIGHT %d", a);
}
}
if(ch=='A') if((p*q)>(3*(x*y)))
if((x>0)&&(abs(z)<10)) printf("FIRE %d", min(20, b));
else printf("FRONT %d", a);
else if((x>0)&&(abs(z)<5)) printf("FIRE %d", min(20, b));
else printf("BACKWARD %d", a);
}