zoukankan      html  css  js  c++  java
  • zoj 3716 Ribbon Gymnastics (思维数学题)

    题目

    以四个顶点为圆心画圆,圆面积不能重合,求四个圆的直径和最大是多少。

    #define _CRT_SECURE_NO_WARNINGS
    
    #include<string.h>
    #include<stdio.h>
    #include<math.h>
    #include<algorithm>
    using namespace std;
    
    double minn(double a,double b,double c)
    {
        
        a=a<b? a:b;
        a=a<c? a:c;
        return a;
    }
    int main()
    {
        double x[10],y[10],l[10];
        while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3])!=EOF)
        {
            l[0]=(x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]);
            l[1]=(x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]);
            l[2]=(x[0]-x[3])*(x[0]-x[3])+(y[0]-y[3])*(y[0]-y[3]);
            l[3]=(x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2]);
            l[4]=(x[1]-x[3])*(x[1]-x[3])+(y[1]-y[3])*(y[1]-y[3]);
            l[5]=(x[2]-x[3])*(x[2]-x[3])+(y[2]-y[3])*(y[2]-y[3]);
            printf("%.8lf
    ",minn(sqrt(l[0])+sqrt(l[5]),sqrt(l[1])+sqrt(l[4]),sqrt(l[2])+sqrt(l[3])));
        }
        return 0;
    }
    View Code
    一道又一道,好高兴!
  • 相关阅读:
    Fence Repair(POJ 3253)
    Saruman's Army(POJ 3069)
    Best Cow Line(POJ 3617)
    一往直前!贪心法
    最基础的“穷竭搜索”
    Lake Counting(POJ 2386)
    Ants(POJ 1852)
    热身题
    分布式锁的三种实现方式
    Redis在实际开发中面临的问题
  • 原文地址:https://www.cnblogs.com/laiba2004/p/3550728.html
Copyright © 2011-2022 走看看