結果
問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2017-06-28 11:44:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,349 bytes |
コンパイル時間 | 811 ms |
コンパイル使用メモリ | 90,692 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 14:43:30 |
合計ジャッジ時間 | 1,468 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 WA * 6 |
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> #include <bitset> using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; double d(double x1, double y1, double x2, double y2) { return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); } int main(){ double x[3], y[3]; FOR (i,0,3) { cin >> x[i] >> y[i]; } FOR(i,0,3) { if(d(x[i%3], y[i%3], x[(i+1)%3], y[(i+1)%3]) == d(x[i%3], y[i%3], x[(i+2)%3], y[(i+2)%3])) { if(sqrt(2.0) * d(x[i%3],y[i%3],x[(i+1)%3],y[(i+1)%3]) == d(x[(i+2)%3],y[(i+2)%3],x[(i+1)%3],y[(i+1)%3])) { // 正方形になる点を探す for (double xx = -200; xx <= 200; xx++) { for (double yy = -200; yy <= 200; yy++) { if(d(xx, yy, x[(i+1)%3], y[(i+1)%3]) == d(xx, yy, x[(i+2)%3], y[(i+2)%3])) { if(sqrt(2.0) * d(xx,yy,x[(i+1)%3],y[(i+1)%3]) == d(x[(i+2)%3],y[(i+2)%3],x[(i+1)%3],y[(i+1)%3])) { if(xx == x[i%3] && yy == y[i%3]) continue; cout << int(xx) << " " << int(yy) << endl; return 0; } } } } } } } cout << -1 << endl; return 0; }