11505 - Logo

All about problems in Volume 115. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
naffi
New poster
Posts: 23
Joined: Wed Mar 19, 2008 12:25 pm
Location: BUET, Bangladesh
Contact:

11505 - Logo

Post by naffi »

removed
Last edited by naffi on Wed Oct 01, 2008 4:20 pm, edited 1 time in total.
Always At Your Help.
redroof
New poster
Posts: 5
Joined: Sun Sep 28, 2008 12:51 pm

Re: WA-11505-LOGO

Post by redroof »

try to change your PI to a more precise one:

Code: Select all

#define PI 0.01745329251994329914588889
naffi
New poster
Posts: 23
Joined: Wed Mar 19, 2008 12:25 pm
Location: BUET, Bangladesh
Contact:

Re: WA-11505-LOGO

Post by naffi »

redroof wrote:try to change your PI to a more precise one:

Code: Select all

#define PI 0.01745329251994329914588889
Thanks redroof for your kind reply. I got AC after changing PI.
Thanks again. :)
Always At Your Help.
mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

Re: WA-11505-LOGO

Post by mukit »

Getting WA

Please give some I/O

Code: Select all

Cut ...

Thanks to helloneo :D.
Last edited by mukit on Tue Nov 18, 2008 8:41 pm, edited 1 time in total.
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Re: WA-11505-LOGO

Post by helloneo »

Try this case..

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
My output is

Code: Select all

141
Nahiyan Kamal
New poster
Posts: 7
Joined: Sat Apr 04, 2009 6:40 pm

Re: 11505 - LOGO

Post by Nahiyan Kamal »

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;
}	
Tausiq
New poster
Posts: 6
Joined: Fri Mar 06, 2009 4:54 pm
Location: just here
Contact:

Re: 11505 - LOGO

Post by Tausiq »

@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 :

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 ! :(
Saswat2603
New poster
Posts: 15
Joined: Tue Feb 12, 2008 10:42 am
Location: Bhubaneswar, Orissa, India

Re: 11505 - LOGO

Post by Saswat2603 »

The above output is WRONG.

Correct output :

Code: Select all

68
37
50
Even the input is WRONG.
lf should be replaced by lt.
Saswat Padhi - lost in for(;;);
metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 11505 - Logo

Post by metaphysis »

"bk" just means move back, the turtle would not turn its head back.
Post Reply

Return to “Volume 115 (11500-11599)”