結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-18 06:56:53 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 692 bytes |
| コンパイル時間 | 1,159 ms |
| コンパイル使用メモリ | 120,960 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-28 03:14:15 |
| 合計ジャッジ時間 | 1,821 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
// No.55 正方形を描くだけの簡単なお仕事です。
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> X(3);
vector<int> Y(3);
for (int i = 0; i < 3; ++i) cin >> X[i] >> Y[i];
for (int i = 0; i < 3; ++i) {
int dx1 = X[(i + 2) % 3] - X[i];
int dy1 = Y[(i + 2) % 3] - Y[i];
int dx2 = X[(i + 1) % 3] - X[i];
int dy2 = Y[(i + 1) % 3] - Y[i];
if (dx1 * dx2 + dy1 * dy2 != 0) continue;
if (dx1 * dx1 + dy1 * dy1 != dx2 * dx2 + dy2 * dy2) continue;
cout << X[(i + 1) % 3] + dx1 << " ";
cout << Y[(i + 1) % 3] + dy1 << endl;
return 0;
}
cout << -1 << endl;
}