結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kpinkcat
提出日時 2023-10-10 13:54:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 904 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 102,924 KB
最終ジャッジ日時 2025-02-17 06:38:56
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main(){
    int a, b, c, d, e, f, g, h, s1, s2, s3;
    cin >> a >> b >> c >> d >> e >> f;
    s1 = (a - c)*(a - c) + (b -d)*(b -d);
    s2 = (c - e)*(c - e) + (d -f)*(d -f);
    s3 = (e - a)*(e - a) + (f - b)*(f - b);
    if (((s1 + s2 != s3) && (s2 + s3 != s1) && (s1 + s3 != s2)) || !((s1 == s2) || (s1 == s3) || (s2 == s3))){
        cout << -1 << endl;
        return 0;
    } else {
        if (s1 + s2 == s3){
            g = a + e - c;
            h = b + f - d;
        } else if (s1 + s3 == s2){
            g = c + e - a;
            h = d + f - b;
        } else {
            g = a + c - e;
            h = b + d - f; 
        }
    }
    cout << g << " " << h << endl; 
}
0