結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
|
提出日時 | 2018-03-21 13:54:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 819 bytes |
コンパイル時間 | 1,569 ms |
コンパイル使用メモリ | 166,224 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 19:29:30 |
合計ジャッジ時間 | 2,373 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#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;}