結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー anta
提出日時 2014-11-03 00:59:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 555 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 61,764 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-14 13:41:39
合計ジャッジ時間 1,239 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <complex>
using namespace std;
typedef complex<int> Point;
int main() {
	Point ps[3];
	for(int i = 0; i < 3; ++ i) {
		int x, y;
		cin >> x >> y;
		ps[i] = Point(x, y);
	}
	for(int i = 0; i < 3; ++ i) {
		Point d1 = ps[(i+1)%3] - ps[i];
		Point d2 = ps[(i+2)%3] - ps[i];
		if(norm(d1) != norm(d2)) continue;
		Point p = ps[(i+1)%3] + d2;
		if(norm(p - ps[i]) != norm(ps[(i+1)%3] - ps[(i+2)%3])) continue;
		cout << p.real() << " " << p.imag() << endl;
		return 0;
	}
	cout << "-1" << endl;
	return 0;
}
0