UVA 10242 — NEEDED HELP

Правка en1, от kazama460, 2017-10-13 00:05:55
#include<bits/stdc++.h>
using namespace std;

int main()
{
	float x1,x2,y1,y2,x3,y3,x4,y4,ansx,ansy;
	
	while(cin>>x1>>y1)
	{
		cin>>x2>>y2>>x3>>y3>>x4>>y4;
		
		if(x1==x3 && y1==y3)
		{
			ansx = x2-x1+x4;
			ansy = y2-y1+y4;
		}
		
		else
		if(x2==x3 && y2==y3)
		{
			ansx = x1-x2+x4;
			ansy = y1-y2+y4;
		}
		else
		if(x1==x4 && y1==y4)
		{
			ansx = x2-x1+x3;
			ansy = y2-y1+y3;
		}
		
		else
		{
			ansx = x1-x2+x3;
			ansy = y1-y2+y3;
		}
		printf("%.3lf %.3lf\n", ansx, ansy);
	}
}

i dont know whats wrong with code , getting wrong answer. if anyone can point out some problem in the code. thank you in advance. Link to problem

Теги computational geometry, maths, uva10242

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский kazama460 2017-10-13 00:05:55 810 Initial revision (published)