結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
![]() |
提出日時 | 2015-06-18 23:25:17 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,285 bytes |
コンパイル時間 | 991 ms |
コンパイル使用メモリ | 85,636 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 13:50:13 |
合計ジャッジ時間 | 1,508 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <iostream> #include <queue> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; double dist(pair<int,int> x, pair<int,int> y){ int dx = x.first - y.first; int dy = x.second - y.second; return sqrt(dx*dx + dy*dy); } int main(){ vector< pair<int,int> > v; rep(i,3){ int x, y; cin >> x >> y; v.push_back(make_pair(x,y)); } rep(i,3){ rep(j,3){ rep(k,3){ if(i==j || j==k || i==k) continue; double dist1 = dist(v[i], v[j]); double dist2 = dist(v[i], v[k]); double dist3 = dist(v[j], v[k]); if(fabs(dist1-dist2)<1e-6 && fabs(sqrt(2)*dist1-dist3)<1e-6){ int nx = v[j].first - v[i].first + v[k].first; int ny = v[j].second - v[i].second + v[k].second; cout << nx << " " << ny << endl; return 0; } } } } cout << -1 << endl; return 0; }