AtCoder Beginner Contest 010

Submission #1673986

Source codeソースコード

#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int, P> PP;

double xa,ya,xb,yb;
int n;
int t,v;
double x[1050];
double y[1050];

double distance(double x0,double y0, double x1, double y1){
	return sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
}

int main()
{
	cin>>xa>>ya>>xb>>yb;
	cin>>t>>v;
	cin>>n;

	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
	}

	double dist=t*v;
	//cout<<dist<<endl;

	int ope=0;
	for(int i=0;i<n;i++){
		//cout<<"a"<<endl;
		double k=distance(xa,ya,x[i],y[i])+distance(x[i],y[i],xb,yb);
		//cout<<k<<endl;
		if(k<dist||abs(k-dist)<EPS)ope++;
	}
	if(ope==0)cout<<"NO"<<endl;
	else cout<<"YES"<<endl;

	return 0;
}

Submission

Task問題 C - 浮気調査
User nameユーザ名 kns330
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 CE
Score得点 -
Source lengthソースコード長 909 Byte
File nameファイル名
Exec time実行時間 -
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:47:24: error: call of overloaded ‘abs(double)’ is ambiguous
if(k<dist||abs(k-dist)<EPS)ope++;
^
In file included from /usr/include/c++/5/cstdlib:72:0,
from /usr/include/c++/5/ext/string_conversions.h:41,
from /usr/include/c++/5/bits/basic_string.h:5334,
from /usr/include/c++/5/string:52,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from ./Main.cpp:1:
/usr/include/stdlib.h:775:12: note: candidate: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^
In file included from /usr/include/c++/5/ext/string_conversions.h:41:0,
from /usr/include/c++/5/bits/basic_string.h:5334,
...

Test case