Submission #1838587


Source Code Expand

#include <iostream>
#include <algorithm>
#include <cstring>
#include<cstdio>
using namespace std;

int main()
{
	int x[3], y[3];
	double ans;

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

	x[1] -= x[0];
	x[2] -=x[0];
	y[1] -= y[0];
	y[2] -= y[0];

	ans = (double)(x[1] * y[2] - x[2] * y[1]) / 2;
	
	ans = abs(ans);
	printf("%.1lf\n", ans);

	return 0;
}

Submission Info

Submission Time
Task C - 直訴
User tunehira
Language C++ (GCC 5.4.1)
Score 0
Code Size 386 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:22:15: error: call of overloaded ‘abs(double&)’ is ambiguous
  ans = abs(ans);
               ^
In file included from /usr/include/c++/5/cstdlib:72:0,
                 from /usr/include/c++/5/bits/stl_algo.h:59,
                 from /usr/include/c++/5/algorithm:62,
                 from ./Main.cpp:2:
/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/bits/stl_algo.h:59:0,
                 from /usr/include/c++/5/algorithm:62,
                 from ./Main.cpp:2:
/usr/include/c++/5/cstdlib:179:3: note: candidate: __int128 std::abs(__int128)
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
   ^
/usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(lo...