11505 - Logo
Moderator: Board moderators
11505 - Logo
removed
Last edited by naffi on Wed Oct 01, 2008 4:20 pm, edited 1 time in total.
Always At Your Help.
Re: WA-11505-LOGO
try to change your PI to a more precise one:
Code: Select all
#define PI 0.01745329251994329914588889
Re: WA-11505-LOGO
Thanks redroof for your kind reply. I got AC after changing PI.redroof wrote:try to change your PI to a more precise one:Code: Select all
#define PI 0.01745329251994329914588889
Thanks again.
Always At Your Help.
Re: WA-11505-LOGO
Last edited by mukit on Tue Nov 18, 2008 8:41 pm, edited 1 time in total.
Re: WA-11505-LOGO
Try this case..
My output is
Code: Select all
1
11
fd 100
lt 90
fd 100
lt 90
fd 100
lt 90
fd 100
lt 90
fd 100
lt 90
fd 100
Code: Select all
141
-
- New poster
- Posts: 7
- Joined: Sat Apr 04, 2009 6:40 pm
Re: 11505 - LOGO
please help.im getting wa. heres my code.
Code: Select all
#include<iostream>
#include<string.h>
#include<math.h>
#define pi 2*acos(0.0)/180
using namespace std;
int main()
{
long cases,n;
double x,y,k;
double thita;
double f,g;
long F,G;
while(scanf("%ld",&cases)==1)
{
while(cases--)
{
x=0,y=0;
thita=90;
scanf("%ld",&n);
while(n--)
{
char ins[10];
double to;
scanf("%s %lf",ins,&to);
if(strcmp(ins,"fd")==0)
{
k=thita*pi;
x+=to*cos(k);
y+=to*sin(k);
}
else if(strcmp(ins,"lt")==0)
thita+=to;
else if(strcmp(ins,"rt")==0)
thita-=to;
}
f=floor(sqrt(x*x+y*y));
g=ceil(sqrt(x*x+y*y));
F=long(f);
G=long(g);
if(((fabs(sqrt(x*x+y*y)-f))>(fabs(sqrt(x*x+y*y)-g))))
printf("%ld\n",G);
else
printf("%ld\n",F);
}
}
return 0;
}
Re: 11505 - LOGO
@Nahiyan Kamal
to convert thita into radian,
thita = thita * pi / 180;
pi = acos(-1.0)
thita is always between 0 to 360 degree
so take care of it, if it goes beyond limit
try this input :
to convert thita into radian,
thita = thita * pi / 180;
pi = acos(-1.0)
thita is always between 0 to 360 degree
so take care of it, if it goes beyond limit
try this input :
Code: Select all
3
5
lf 60
fd 20
rt 30
fd 50
rt 45
3
fd 20
lf 15
fd 17
6
fd 50
lf 90
fd 50
lf 90
fd 50
lf 90
Code: Select all
output :
25
22
120
I took an IQ test .. and the results were negative !
-
- New poster
- Posts: 15
- Joined: Tue Feb 12, 2008 10:42 am
- Location: Bhubaneswar, Orissa, India
Re: 11505 - LOGO
The above output is WRONG.
Correct output :
Even the input is WRONG.
lf should be replaced by lt.
Correct output :
Code: Select all
68
37
50
lf should be replaced by lt.
Saswat Padhi - lost in for(;;);
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 11505 - Logo
"bk" just means move back, the turtle would not turn its head back.
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.