本文已参与「新人创作礼」活动,一起开启掘金创作之路。
题目链接:
链接:ac.nowcoder.com/acm/contest…
来源:牛客网
Bobo has a triangle ABC with A(x1,y1),B(x2,y2)A(x_1, y_1), B(x_2, y_2)A(x1,y1),B(x2,y2) and C(x3,y3)C(x_3, y_3)C(x3,y3). Picking a point P uniformly in triangle ABC, he wants to know the expectation value E=max{SPAB,SPBC,SPCA}E = \max{S_{PAB}, S_{PBC}, S_{PCA}}E=max{SPAB,SPBC,SPCA} where SXYZS_{XYZ}SXYZ denotes the area of triangle XYZ.
Print the value of 36×E36 \times E36×E. It can be proved that it is always an integer.
输入描述:
The input consists of several test cases and is terminated by end-of-file.
Each test case contains six integers x1,y1,x2,y2,x3,y3x_1, y_1, x_2, y_2, x_3, y_3x1,y1,x2,y2,x3,y3.
* ∣x1∣,∣y1∣,∣x2∣,∣y2∣,∣x3∣,∣y3∣≤108|x_1|, |y_1|, |x_2|, |y_2|, |x_3|, |y_3| \leq 10^8∣x1∣,∣y1∣,∣x2∣,∣y2∣,∣x3∣,∣y3∣≤108
* There are at most 10510^5105 test cases.
输出描述:
For each test case, print an integer which denotes the result.
思路:
编辑
编辑
AC代码:
#include<bits/stdc++.h>
#define up(i, x, y) for(int i = x; i <= y; i++)
#define down(i, x, y) for(int i = x; i >= y; i--)
#define maxn ((int)1e5 + 10)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
ll x1, x2, x3, y1, y2, y3;
int main()
{
while(cin>>x1>>y1>>x2>>y2>>x3>>y3)
{
cout<< (abs((x1 * y2 + x3 * y1 + x2 * y3) - (x1 * y3 + x3 * y2 + x2 * y1)) * 11 ) << '\n';
}
}