http://47.96.116.66/problem.php?id=1913
题解
可以通过相似三角形得出线段比值关系,从而证明出反向延长线将三角形分割成两个面积一样的三角形,则该线即是中线交点,初中时老师说过,中线交点是重心,那么,重心交点便是( (x1+x2+x3)/3, (y1+y2+y3)/3 ),最后将坐标答案乘上3的逆元即可。
这是题解,找相似条件找到怀疑人生…还是没有找到,不过
代码难度不大,就是注意逆元,
主要还是中线的证明开始没有想到
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<set>
#include<map>
#include<iterator>
#include<queue>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
const int N=5e6+10;
const long long INF=1e18;
const double eps=0.0000001;
int a[N];char str[N];
const int mod=1e9+7;
ll qpow(ll a,ll n,ll p)
{
ll res=1;
ll base=a%p;
while(n)
{
if(n&1) res=(res*base)%p;
base=(base*base)%p;
n>>=1;
}
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
ll x1,x2,x3,y1,y2,y3;
ll x,y;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
x=x1+x2+x3;
y=y1+y2+y3;
ll inv=qpow(3,mod-2,mod);
if(x%3==0)
{
cout<<x/3;
}
else
{
cout<<(x*inv)%mod;
}
cout<<" ";
if(y%3==0)
{
cout<<y/3;
}
else
{
cout<<(y*inv)%mod<<endl;
}
}