Submission #3020022


Source Code Expand

#include <iostream>
#include <vector>
#include <functional>
using namespace std;


int main()
{
	int N;
	cin >> N;
	vector<double> x(N), y(N);
	for (int i = 0; i < N; i++)
		cin >> x[i] >> y[i];
	double distance = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)) > distance)
				distance = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
		}
	}

	cout << distance << endl;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:19:31: error: ‘pow’ was not declared in this scope
    if (sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)) > distance)
                               ^
./Main.cpp:19:54: error: ‘sqrt’ was not declared in this scope
    if (sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)) > distance)
                                                      ^