A. Pashmak and Garden1200 / 思维

Posted 幽殇默

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A. Pashmak and Garden1200 / 思维相关的知识,希望对你有一定的参考价值。


https://codeforces.com/problemset/problem/459/A
分类讨论:

  • 同行,必有解
  • 同列,必有解
  • 对角,看距离相不相等。
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int x,y,xx,yy; cin>>x>>y>>xx>>yy;
	if(x==xx) 
	{
		int len=abs(y-yy);
		cout<<x+len<<" "<<y<<" "<<x+len<<" "<<yy<<endl; 
	}else if(y==yy)
	{
		int len=abs(x-xx);
		cout<<x<<" "<<y+len<<" "<<xx<<" "<<y+len<<endl; 
	}else
	{
		int len1=abs(x-xx),len2=abs(y-yy);
		if(len1!=len2) puts("-1");
		else printf("%d %d %d %d",x,yy,xx,y);
	}
	return 0;
}

以上是关于A. Pashmak and Garden1200 / 思维的主要内容,如果未能解决你的问题,请参考以下文章

Codeforce 459A - Pashmak and Garden (已知两点求另外两点构成正方形)

A. Chewbaсca and Number1200 / 贪心

A. Chewbaсca and Number1200 / 贪心

Pashmak and Flowers

B. Pashmak and Flowers1300 / 思维

CF459E Pashmak and Graph