結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー twice_l
提出日時 2017-12-27 19:41:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 613 ms
コンパイル使用メモリ 67,096 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 07:57:15
合計ジャッジ時間 1,688 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 19 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
  int x[4], y[4];
  for(int i=0; i<3; ++i){
    cin >> x[i] >> y[i];
  }

  for(int i=0; i<3; ++i){
    if(hypot(x[i]-x[(i+1)%3], y[i]-y[(i+1)%3]) == hypot(x[i]-x[(i+2)%3], y[i]-y[(i+2)%3])){
      if(((y[(i+1)%3]-(double)y[i]) * (y[(i+2)%3]-(double)y[i])) / ((x[(i+1)%3]-(double)x[i]) * (x[(i+2)%3]-(double)x[i])) == -1){
        x[3] = x[(i+1)%3] + x[(i+2)%3] - x[i];
        y[3] = y[(i+1)%3] + y[(i+2)%3] - y[i];
        cout << x[3] << " " << y[3] << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
0