zoukankan      html  css  js  c++  java
  • 已知三角形三个顶点求三角形内心

    #include<iostream>
    #include<math.h>
    #include<stdio.h>
    using namespace std;
    double x[3],y[3];
    int main()
    {
        while(~scanf("%lf%lf",&x[0],&y[0]))
        {
            scanf("%lf%lf",&x[1],&y[1]);
            scanf("%lf%lf",&x[2],&y[2]);
            double c=sqrt((x[0]-x[1])*(x[0]-x[1])+ (y[0]-y[1])*(y[0]-y[1]));
            double a=sqrt((x[1]-x[2])*(x[1]-x[2])+ (y[1]-y[2])*(y[1]-y[2]));
            double b=sqrt((x[2]-x[0])*(x[2]-x[0])+ (y[2]-y[0])*(y[2]-y[0]));
            printf("%.2lf %.2lf ",(a*x[0]+b*x[1]+c*x[2])/(a+b+c), (a*y[0]+b*y[1]+c*y[2])/(a+b+c));
        }
        return 0;
    }

  • 相关阅读:
    mysql资料
    MySQL启动与关闭
    poj 2778 DNA Sequence
    poj 1625 Censored!
    zoj 3228 Searching the String
    hdu 4605 Magic Ball Game
    hdu 4610 Cards
    SGU 439 A Secret Book
    NOI2013
    NOI2014
  • 原文地址:https://www.cnblogs.com/lxm940130740/p/3362063.html
Copyright © 2011-2022 走看看