11068 - An Easy Task

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

Moderator: Board moderators

temper_3243
Experienced poster
Posts: 105
Joined: Wed May 25, 2005 7:23 am

11068 - An Easy Task

Post by temper_3243 » Mon Aug 14, 2006 9:01 pm

you might try to mirror the plane first at one line, then at the second line. What does that statement mean . i don't understand the problem clearly. Can anyone help

User avatar
cytmike
Learning poster
Posts: 95
Joined: Mon Apr 26, 2004 1:23 pm
Location: Hong Kong and United States
Contact:

Post by cytmike » Tue Aug 15, 2006 2:14 am

I keep getting WAs on this problem. Can anyone help? :evil:

This is my code.

Code: Select all

removed after AC
Last edited by cytmike on Tue Aug 15, 2006 11:23 pm, edited 1 time in total.
Impossible is Nothing.

User avatar
cytmike
Learning poster
Posts: 95
Joined: Mon Apr 26, 2004 1:23 pm
Location: Hong Kong and United States
Contact:

Re: 11068

Post by cytmike » Tue Aug 15, 2006 7:06 pm

temper_3243 wrote:you might try to mirror the plane first at one line, then at the second line. What does that statement mean . i don't understand the problem clearly. Can anyone help
In my opinion, the question is asking for the intersection point of the lines (if any), is that the whole thing this question is asking?
Impossible is Nothing.

david
Learning poster
Posts: 83
Joined: Mon Apr 21, 2003 10:14 pm

Re: 11068

Post by david » Tue Aug 15, 2006 7:21 pm

cytmike wrote: In my opinion, the question is asking for the intersection point of the lines (if any), is that the whole thing this question is asking?
Well, the question doesn't ask that directly, although it ends up being just that. The question is asking whether the composition of two "mirrorings" (that is, a reflection over one of the lines followed by another reflection over the other line) has a fixed point (a point which is left at the same place afther these two steps).

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko » Tue Aug 15, 2006 8:43 pm

cytmike wrote:I keep getting WAs on this problem. Can anyone help? :evil:
Try this one:

Code: Select all

-19 100 43
19 -53 55
0 0 0
0 0 0
My AC's output:

Code: Select all

The fixed point is at 8.71 2.09.

User avatar
cytmike
Learning poster
Posts: 95
Joined: Mon Apr 26, 2004 1:23 pm
Location: Hong Kong and United States
Contact:

Post by cytmike » Tue Aug 15, 2006 11:24 pm

thank you martin, I get AC in 5 minutes after reading your post. Stupid precision problem.
Impossible is Nothing.

kolpobilashi
Learning poster
Posts: 54
Joined: Mon Jan 02, 2006 3:06 am
Location: Dhaka,Bangladesh
Contact:

Post by kolpobilashi » Sat Aug 19, 2006 9:20 pm

:( what's wrong in my code.......why i'm getting WA???

Code: Select all

 removed fOOlish code!!
Last edited by kolpobilashi on Sat Aug 19, 2006 10:31 pm, edited 1 time in total.
Sanjana

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf » Sat Aug 19, 2006 9:38 pm

Here's a couple of tests:

Code: Select all

1 2 3 2 4 7
0 1 0 1 2 0
0 0 0 0 0 0
The correct output is:

Code: Select all

No fixed point exists.
The fixed point is at 0.00 0.00.

kolpobilashi
Learning poster
Posts: 54
Joined: Mon Jan 02, 2006 3:06 am
Location: Dhaka,Bangladesh
Contact:

Post by kolpobilashi » Sat Aug 19, 2006 10:31 pm

:D thanx a lot.....i was really stupid...got AC now.
Sanjana

uvasarker
Learning poster
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh
Contact:

11068 An Easy Task (WA) Why? Please, help

Post by uvasarker » Thu Dec 29, 2011 8:23 am

/* Removed */
Last edited by uvasarker on Sat Jan 28, 2012 7:33 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11068 An Easy Task (WA) Why? Please, help

Post by brianfry713 » Fri Jan 13, 2012 1:44 am

You should post in the existing thread.
Check input and AC output for thousands of problems on uDebug!

uvasarker
Learning poster
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11068 - An Easy Task

Post by uvasarker » Sun Feb 12, 2012 5:02 am

I check previous posted of this topic and try all test cases and my code gives correct answer, but when I submit my code to the judge they reply to verdict WA WA WA.
Why? Please, give me some information on my code or critical input-output. Please...............

Code: Select all

    #include<cstdio>
    #include<sstream>
    #include<cstdlib>
    #include<cctype>
    #include<cmath>
    #include<algorithm>
    #include<set>
    #include<queue>
    #include<stack>
    #include<list>
    #include<iostream>
    #include<fstream>
    #include<numeric>
    #include<string>
    #include<vector>
    #include<cstring>
    #include<map>
    #include<iterator>
    using namespace std;
    int main()
    {
       
       float a1,a2,b1,b2,c1,c2;
       while(scanf("%f %f %f %f %f %f",&a1,&b1,&c1,&a2,&b2,&c2)==6)
       {
          if(a1==0 && a2==0 && b1==0 && b2==0 && c1==0 && c2==0)
             break;
          float x1=0.0,y1=0.0;
          float difa=0.0,difb=0.0,minx=0.0;
          
          
          if(a1==a2 && b1==b2)
             printf("No fixed point exists.\n");
          else
          {
             if(a1>a2)
             {
                if(a1<0)
                {
                   a1=a1*(-1.0);
                   b1=b1*(-1.0);
                   c1=c1*(-1.0);
                }
                if(a2<0)
                {
                   a2=a2*(-1.0);
                   b2=b2*(-1.0);
                   c2=c2*(-1.0);
                }            
                if(a2==0) difa=a1;
                else
                difa=a1/a2;
             }
             else
             {
                if(a1<0)
                {
                   a1=a1*(-1.0);
                   b1=b1*(-1.0);
                   c1=c1*(-1.0);
                }
                if(a2<0)
                {
                   a2=a2*(-1.0);
                   b2=b2*(-1.0);
                   c2=c2*(-1.0);
                }            
                if(a1==0) difa=a2;
                else
                difa=a2/a1;
             }
             if(b1>b2)
             {
                if(b1<0)
                {
                   b1=b1*(-1.0);
                   a1=a1*(-1.0);
                   c1=c1*(-1.0);
                }
                if(b2<0)
                {
                   b2=b2*(-1.0);
                   a2=a2*(-1.0);
                   c2=c2*(-1.0);
                }
                if(b2==0) difb=b1;
                else            
                difb=b1/b2;
             }
             else
             {
                if(b1<0)
                {
                   b1=b1*(-1.0);
                   a1=a1*(-1.0);
                   c1=c1*(-1.0);
                }
                if(b2<0)
                {
                   b2=b2*(-1.0);
                   a2=a2*(-1.0);
                   c2=c2*(-1.0);
                }
                if(b1==0) difb=b2;
                else
                difb=b2/b1;
             }
             minx=min(difa,difb);
             if( (minx==difa && a1<a2 && difa>1) || (minx==difb && b1<b2 && difb>1) )
                {
                   a1=a1*minx;
                   b1=b1*minx;
                   c1=c1*minx;
                }
             else if( (minx==difa && a2<a1 && difa>1) || (minx==difb && b2<b1 && difb>1) )
                {
                   a2=a2*minx;
                   b2=b2*minx;
                   c2=c2*minx;
                }
             if(a1==a2 && b1==b2)
                printf("No fixed point exists.\n");
             else
             {
                if(b1==b2)
                {
                   x1=(c1-c2)/(a1-a2);
                   y1=(c1-(a1*x1))/b1;
                }
                else if(a1==a2)
                {
                   y1=(c1-c2)/(b1-b2);
                   x1=(c1-(b1*y1))/a1;
                }
                printf("The fixed point is at %.2f %.2f.\n",x1,y1);
             }
          }
          
       }
       
       return 0;
    }



brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11068 - An Easy Task

Post by brianfry713 » Tue Feb 14, 2012 1:26 am

Input:

Code: Select all

1 0 1
2 0 2
0 0 1
1 2 3
1 2 3
0 0 1
1 2 4
1 0 1
1 0 1
1 2 5
1 2 3
1 2 4
6 5 11
2 43 -23
0 0 0
0 0 0
Output from my AC code:

Code: Select all

No fixed point exists.
No fixed point exists.
No fixed point exists.
The fixed point is at 1.00 1.50.
The fixed point is at 1.00 2.00.
No fixed point exists.
The fixed point is at 2.37 -0.65.
Check input and AC output for thousands of problems on uDebug!

uvasarker
Learning poster
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11068 - An Easy Task

Post by uvasarker » Sat Feb 18, 2012 5:58 am

Hi
Boss
I am frustrated.............Still WA. Here is my code:

Code: Select all

#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
using namespace std;
int main()
{
	
	double a1,a2,b1,b2,c1,c2;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a1,&b1,&c1,&a2,&b2,&c2)==6)
	{
		if(a1==0 && a2==0 && b1==0 && b2==0 && c1==0 && c2==0)
			break;
		double x1=0.0,y1=0.0;
		double difa=0.0,difb=0.0,minx=0.0;
		
		
		if( (a1==a2 && b1==b2) || (a1==0.0 && b1==0.0) || (a2==0.0 && b2==0.0) || (a1==c1 && a2==c2 && b1==b2))
			printf("No fixed point exists.\n");
		else
		{
			if(a1>a2)
			{
				if(a1<0)
				{
					a1=a1*(-1.0);
					b1=b1*(-1.0);
					c1=c1*(-1.0);
				}
				if(a2<0)
				{
					a2=a2*(-1.0);
					b2=b2*(-1.0);
					c2=c2*(-1.0);
				}				
				if(a2==0) difa=a1;
				else
				difa=a1/a2;
			}
			else
			{
				if(a1<0)
				{
					a1=a1*(-1.0);
					b1=b1*(-1.0);
					c1=c1*(-1.0);
				}
				if(a2<0)
				{
					a2=a2*(-1.0);
					b2=b2*(-1.0);
					c2=c2*(-1.0);
				}				
				if(a1==0) difa=a2;
				else
				difa=a2/a1;
			}
			if(b1>b2)
			{
				if(b1<0)
				{
					b1=b1*(-1.0);
					a1=a1*(-1.0);
					c1=c1*(-1.0);
				}
				if(b2<0)
				{
					b2=b2*(-1.0);
					a2=a2*(-1.0);
					c2=c2*(-1.0);
				}
				if(b2==0) difb=b1;
				else				
				difb=b1/b2;
			}
			else
			{
				if(b1<0)
				{
					b1=b1*(-1.0);
					a1=a1*(-1.0);
					c1=c1*(-1.0);
				}
				if(b2<0)
				{
					b2=b2*(-1.0);
					a2=a2*(-1.0);
					c2=c2*(-1.0);
				}
				if(b1==0) difb=b2;
				else
				difb=b2/b1;
			}
			minx=min(difa,difb);
			if( (minx==difa && a1<a2 && difa>1) || (minx==difb && b1<b2 && difb>1) )
				{
					a1=a1*minx;
					b1=b1*minx;
					c1=c1*minx; 
				}
			else if( (minx==difa && a2<a1 && difa>1) || (minx==difb && b2<b1 && difb>1) )
				{
					a2=a2*minx;
					b2=b2*minx;
					c2=c2*minx;
				}
			if(a1==a2 && b1==b2)
				printf("No fixed point exists.\n");
			else
			{
				if(b1==b2)
				{
					x1=(c1-c2)/(a1-a2);
					y1=(c1-(a1*x1))/b1;
				}
				else if(a1==a2)
				{
					y1=(c1-c2)/(b1-b2);
					x1=(c1-(b1*y1))/a1;
				}
				printf("The fixed point is at %.2lf %.2lf.\n",x1,y1);
			}
		}
		
	}
	
	return 0;
}


brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11068 - An Easy Task

Post by brianfry713 » Tue Feb 21, 2012 9:02 am

Input

Code: Select all

24 -18 67
73 -81 -33
0 0 0
0 0 0
My AC output

Code: Select all

The fixed point is at 9.56 9.02.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 110 (11000-11099)”