Page 2 of 3
Go to...
Posted: Thu Apr 15, 2004 5:13 am
by _.B._
Greetings!.
Go to:
http://online-judge.uva.es/board/viewtopic.php?t=5466
It might be of help for you.
P.S.: I used "double" and got AC in 0:00.002, then used "real" and got AC in 0:00.000. The problem says:
All coordinates are between -10000 and +10000.
So I believe that's why "real" is enough.
Posted: Thu Apr 15, 2004 12:34 pm
by mlvahe
_.B._ I really don't know why there are empty lines in the input.
The only idea I have is there is a blank line after the input.
Right.
Posted: Thu Apr 15, 2004 10:34 pm
by _.B._
Perhaps mlvahe. Might be some mistake if they left the empty line at the end. That's a sure WA for us Pascal users

Still don't know why they don't use simple input, without tricks and whitspaces and empty lines... like I read in one post, they should do a problem of that kind, if they want to, but throw only good input.
Anyway, it was great you noticed it

10242 Is this formula right?
Posted: Mon Oct 04, 2004 7:55 pm
by Morning
if i know (x0,y0),(x1,y1),(x2,y2) as three adjacent point of a parallelogram,and (x0,y0) belongs the 1st line,(x1,y1) is the link point of 1st line and 2nd line,(x2,y2) belongs the 2nd line.
can i calculate the 4th point (x3,y3) by
Code: Select all
x3 = x0 + x2 - x1
y3 = y0 + y2 - y1
???????
[cpp]
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
double x0,y0,x1,y1,x2,y2,x3,y3;
while(cin >> x0 >> y0 >> x1 >> y1 >> x1 >> y1 >> x2 >> y2)
{
x3 = x0 + x2 - x1;
y3 = y0 + y2 - y1;
printf("%.3lf %.3lf\n",x3,y3);
}
return 0;
}
[/cpp]
Posted: Mon Oct 04, 2004 8:10 pm
by Eduard
Formula is right! But nobody tell you that in the input endpoints are given one after another in right form for example your programm can pase this input.
Code: Select all
1.000 0.000 3.500 3.500 3.500 3.500 0.000 1.000
But not this.
Code: Select all
1.000 0.000 3.500 3.500 0.000 1.000 3.500 3.500
Hope it helps.
Eduard
Posted: Mon Oct 04, 2004 8:29 pm
by Morning
yeah ,u r right.thanks,buddy
Posted: Tue Sep 13, 2005 8:30 am
by kenneth
Just a note that for C++ users, use double but NOT float
anyone help to understand this problem...........
Posted: Mon Jan 07, 2008 11:48 am
by apurba
someone pls explain this problem....no 10242
thanks in advance........
Posted: Mon Jan 07, 2008 11:59 am
by mf
What exactly do you want to be explained?
If you don't understand the problem statement, get a dictionary.
Re: 10242 - Fourth Point!!
Posted: Tue Aug 26, 2008 6:25 pm
by newton
Why im getting WA?
Please help
Code: Select all
#include <cstdio>
#include <cmath>
#include <algorithm>
#define eps 1e-7
int main(){
//freopen("in.txt","rt",stdin);
double x1,y1,x2,y2,x3,y3,x4,y4;
while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4) == 8){
if(fabs(x2-x3) < eps && fabs(y2-y3) < eps){
x3 = x4;
y3 = y4;
}
printf("%.3lf %.3lf\n",x1+x3-x2,y1+y3-y2);
}
return 0;
}
Re: 10242 - Fourth Point!!
Posted: Mon Feb 23, 2009 10:57 am
by Obaida
You should check which two points match and then go for the 4th point.

Re: 10242 - Fourth Point!!
Posted: Thu Oct 15, 2009 5:59 am
by talizmelf
I checked wich two points match and I still get WA
Code: Select all
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
double ax1, ay1, ax2, ay2, bx1, by1, bx2, by2, x, y;
while (!cin.eof()){
cin >> ax1 >> ay1 >> ax2 >> ay2 >> bx1 >> by1 >> bx2 >> by2;
if (ax1 == bx1 && ay1 == by1) {x = ax2+bx2-ax1; y = ay2+by2-ay1;}
else if (ax1 == bx2 && ay1 == by2) {x = ax2+bx1-ax1; y = ay2+by1-ay1;}
else if (ax2 == bx1 && ay2 == by1) {x = ax1+bx2-ax2; y = ay1+by2-ay2;}
else {x = ax1+bx1-ax2; y = ay1+by1-ay2;}
printf("%0.3f %0.3f\n", x, y);
}
}
can anyone help?
Re:
Posted: Fri Oct 22, 2010 11:47 pm
by sh415
Caesum wrote:you dont know for sure that (x2,y2) and (x3,y3) are the common point.
its an interesting problem......
here we are give the point of two connected side of a parallelogram.
so; actually we are given 3 points..................
we just have to find the fourth one........
suppose; we are given 1 2 3 2 points(1,2,3 repesents different identity )
here 4th point are same ( 1, 2, 3, 2) with 3 rd point. now we have to decide the 3 rd point from the condition and then calculate the fourth one which is unknown...................
we may have other input like 1 2 1 3 or 1 2 2 3...........................
Re: 10242 - Fourth Point!!
Posted: Tue Jun 21, 2011 7:17 pm
by live_lie
thank you keneth and obaida you helped me to get an AC.
Re: 10242 - Fourth Point!!
Posted: Tue Dec 03, 2013 3:03 am
by brianfry713
Input:
Code: Select all
0.000 1.000 0.000 0.000 0.000 1.000 1.000 1.000
0.000 1.000 0.000 0.000 1.000 1.000 0.000 1.000
0.000 0.000 0.000 1.000 0.000 1.000 1.000 1.000
0.000 0.000 0.000 1.000 1.000 1.000 0.000 1.000
Output should be:
Code: Select all
1.000 0.000
1.000 0.000
1.000 0.000
1.000 0.000