結果
問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2017-06-28 11:41:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,286 bytes |
コンパイル時間 | 908 ms |
コンパイル使用メモリ | 89,272 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 14:43:17 |
合計ジャッジ時間 | 1,602 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 14 WA * 7 |
ソースコード
#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) * 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 = -100; xx <= 100; xx++) { for (double yy = -100; yy <= 100; 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) * 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])) { cout << int(xx) << " " << int(yy) << endl; return 0; } } } } } } } cout << -1 << endl; return 0; }