結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
chakku
|
| 提出日時 | 2016-03-16 02:42:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,498 bytes |
| コンパイル時間 | 645 ms |
| コンパイル使用メモリ | 66,020 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 20:11:31 |
| 合計ジャッジ時間 | 1,579 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 WA * 8 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int x[3];
int y[3];
double dict(int a, int b, int c, int d){
return sqrt((double)((a - c)*(a - c) + (b - d)*(b - d)));
}
double dict0(int xx, int yy){
return dict(x[0], y[0], xx, yy);
}
double dict1(int xx, int yy){
return dict(x[1], y[1], xx, yy);
}
double dict2(int xx, int yy){
return dict(x[2], y[2], xx, yy);
}
int main(){
for (int i = 0; i < 3; i++) cin >> x[i] >> y[i];
if (dict0(x[1], y[1]) == dict0(x[2], y[2])){
double d = dict0(x[1], y[1]);
for (int i = -100; i <= 100; i++) for (int j = -100; j <= 100; j++){
if (dict(i, j, x[1], y[1]) == d && dict(i, j, x[2], y[2]) == d){
if (i == x[0] && j == y[0]) continue;
cout << i << " " << j << endl;
return 0;
}
}
}
else if (dict1(x[0], y[0]) == dict1(x[2], y[2])){
double d = dict1(x[0], y[0]);
for (int i = -100; i <= 100; i++) for (int j = -100; j <= 100; j++){
if (dict(i, j, x[0], y[0]) == d && dict(i, j, x[2], y[2]) == d){
if (i == x[1] && j == y[1]) continue;
cout << i << " " << j << endl;
return 0;
}
}
}
else if (dict2(x[0], y[0]) == dict2(x[1], y[1])){
double d = dict2(x[0], y[0]);
for (int i = -100; i <= 100; i++) for (int j = -100; j <= 100; j++){
if (dict(i, j, x[0], y[0]) == d && dict(i, j, x[1], y[1]) == d){
if (i == x[2] && j == y[2]) continue;
cout << i << " " << j << endl;
return 0;
}
}
}
else{
cout << -1 << endl;
return 0;
}
}
chakku