結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー | moti |
提出日時 | 2016-01-02 16:00:57 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,331 bytes |
コンパイル時間 | 714 ms |
コンパイル使用メモリ | 98,984 KB |
最終ジャッジ日時 | 2024-04-27 02:16:51 |
合計ジャッジ時間 | 1,115 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
In file included from main.cpp:5: /usr/include/c++/11/complex: In instantiation of ‘std::complex<double>& std::complex<double>::operator=(const std::complex<_Tp>&) [with _Tp = int]’: main.cpp:44:85: required from here /usr/include/c++/11/complex:1328:31: error: cannot convert ‘std::complex<int>’ to ‘std::complex<double>::_ComplexT’ {aka ‘__complex__ double’} in assignment 1328 | _M_value = __z.__rep(); | ~~~~~~~~~^~ | | | std::complex<int>
ソースコード
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <complex> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <iomanip> #include <assert.h> #include <array> #include <cstdio> #include <cstring> #include <random> #include <functional> #include <numeric> #include <bitset> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; auto I = complex<double>(0, 1); int main() { pair<int, int> ps[3]; rep(i,3) cin >>ps[i].first>>ps[i].second; sort(ps, ps+3); do { complex<double> v[2]; rep(i, 2) { v[i] = complex<int>(ps[i+1].first - ps[0].first, ps[i+1].second - ps[0].second); } if(v[0] * I == v[1]) { cout << ps[0].first + (v[0] + v[1]).real() << " " << ps[0].second + (v[0] + v[1]).imag() << endl; exit(0); } } while(next_permutation(ps, ps+3)); cout << -1 << endl; return 0; }