結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー 西尾西尾
提出日時 2018-03-21 13:54:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 1,552 ms
コンパイル使用メモリ 164,624 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 00:52:55
合計ジャッジ時間 2,913 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef struct { int x; int y; } point;

int Len2( const point &a, const point &b )
{
int i = a.x - b.x;
int j = a.y - b.y;

	return i * i + j * j;
}

void P4( point &New, const point &a, const point &b, const point &c )
{
	New.x = a.x + b.x - c.x;
	New.y = a.y + b.y - c.y;
}

int main()
{
int iA;
int iB;
int iC;
point A;
point B;
point C;
point New;

	cin >> A.x;
	cin >> A.y;
	cin >> B.x;
	cin >> B.y;
	cin >> C.x;
	cin >> C.y;

	iA = Len2( B, C );
	iB = Len2( A, C );
	iC = Len2( A, B );

	if( iB == iC && iB + iC == iA )
		P4( New, B, C, A );
	else if( iA == iC && iA + iC == iB )
		P4( New, A, C, B );
	else if( iA == iB && iA + iB == iC )
		P4( New, A, B, C );
	else
	{
		cout << - 1 << endl;

		return 0;
	}

	cout << New.x << " " << New.y << endl;

	return 0;
}
0