結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-06-24 08:47:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,252 bytes |
| コンパイル時間 | 753 ms |
| コンパイル使用メモリ | 85,048 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 13:50:22 |
| 合計ジャッジ時間 | 1,579 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
int plen(int x1,int y1,int x2,int y2){
return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
bool solve(int Px,int Py,int X1,int Y1,int X2,int Y2,int* aX,int*aY){
bool ans = false;
if( plen(Px,Py,X1,Y1) == plen(Px,Py,X2,Y2) ){
if( (X1-Px)*(X2-Px) + (Y1-Py)*(Y2-Py) == 0){
*aX = X2+X1-Px;
*aY = Y2+Y1-Py;
ans = true;
}
}
return ans;
}
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(6);//
int ansX,ansY;
bool ansf = false;
int X[3],Y[3];
rep(i,3){
cin>>X[i]>>Y[i];
}
for(int i=0;i<3;++i)
{
ansf = solve(X[i%3],Y[i%3],X[(i+1)%3],Y[(i+1)%3],X[(i+2)%3],Y[(i+2)%3],
&ansX,&ansY);
if( ansf == true ){
cout << ansX << " " << ansY << endl;
break;
}
}
if( ansf == false){
cout << -1 << endl;
}
return 0;
}
IL_msta