Submission #3419309
Source Code Expand
#include<iostream> #include<vector> #include<math.h> using namespace std; int main() { int N; cin >> N; vector<int> x(N), y(N); for(int i = 0; i < N; ++i){ cin >> x[i] >> y[i]; } for(int i = 0; i < N; ++i){ vector<double> ax, ay, ab, rab; for(int t = 0; t < N; ++t){ ax = x[i] - x[t]; ay = y[i] - y[t]; ab = ax*ax + ay*ay; rab = sqrt(ab); } } double minl; minl = *min_element(rab); cout << minl << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - 2点間距離の最大値 ( The longest distance ) |
User | Kant |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 486 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:15:10: error: no match for ‘operator=’ (operand types are ‘std::vector<double>’ and ‘__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}’) ax = x[i] - x[t]; ^ In file included from /usr/include/c++/5/vector:69:0, from ./Main.cpp:2: /usr/include/c++/5/bits/vector.tcc:167:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = double; _Alloc = std::allocator<double>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/5/bits/vector.tcc:167:5: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}’ to ‘const std::vector<double>&’ In file included from /usr/include/c++/5/vector:64:0, from ./Main.cpp:2: /usr/include/c++/5/bits/stl_vector.h:448:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = do...