Submission #2697299


Source Code Expand

#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(){
    int N,x,y,max_len=0;
    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> x >> y;
        max_len = max(max_len,sqrt(int(pow(x,2) + pow(y,2))))
    }
    cout << max_len << endl;

    return 0;
}

Submission Info

Submission Time
Task A - 2点間距離の最大値 ( The longest distance )
User Bondo416
Language C++14 (GCC 5.4.1)
Score 0
Code Size 312 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:61: error: no matching function for call to ‘max(int&, double)’
         max_len = max(max_len,sqrt(int(pow(x,2) + pow(y,2))))
                                                             ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
./Main.cpp:11:61: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘double’)
         max_len = max(max_len,sqrt(int(pow(x,2) + pow(y,2))))
                                                             ^
In file i...