zoukankan      html  css  js  c++  java
  • JLU1205

    垃圾几何题 JLU的题目不是叙述奇怪就是数据奇怪
    WA估计是精度问题
    #include<stdio.h>
    #include
    <string.h>
    #include
    <math.h>

    struct Point
    {
        
    float x, y;
    }
    ;

    float t;
    float aB;
    float moveA;
    Point center;
    float y;
    float distan(Point p1, Point p2)
    {
         
    float dis=(float)sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
         
    return dis;
    }


    float area()
    {
        
    float A;
        A
    =(float)(2.0*acos(-1.0)-2.0*(acos(y/432000.0)));
        
    float Area1=A/2.0*432000.0*432000.0;
        Area1
    +=(float)(y*(432000.0*sin(acos(y/432000.0))));
        
    float result=(Area1/(acos(-1.0)*432000.0*432000.0));
        
    if(result<1)
            
    return result;
        
    else
            
    return 1.0;
    }


    void run()
    {
        
    float A=aB-moveA;
        Point pc;
        pc.x
    =(float)cos(A)*3950.0;
        pc.y
    =-(float)sin(A)*3950.0;
        
    float lineA=(float)(acos(-1.0)-(A-acos(-1.0)/2.0));

        
    float k=tan(lineA);
        
    if(tan(lineA)>acos(-1.0))k=tan(lineA-acos(-1.0));
        y
    =k*(92900000.0-pc.x)+pc.y;
        
    if(y<0)
        
    {
            y
    =-y;
            printf(
    "%lf\n",1.0-area());
        }

        
    else
            printf(
    "%lf\n",area());
    }


    void begin()
    {
        
    float a1 ,a2;
        Point p1;
        p1.x
    =92900000.0,p1.y=-432000.0;
        a1
    =(float)acos(3950.0/distan(center,p1));
        a2
    =(float)asin(432000.0/distan(center,p1));
        aB
    =a1+a2;
    }


    int main()
    {
        center.x
    =0.0,center.y=0.0;
        begin();
        
    while(scanf("%f",&t)==1)
        
    {
            moveA
    =2.0*t*acos(-1.0)/(24.0*3600.0);
            run();
        }

        
    return 0;
    }
  • 相关阅读:
    Linux 中国镜像
    VMWare 安装 Debian 9
    Linux 安装Docker compose 快速方法
    Nginx on Docker 配置
    Docker 中配置Nginx
    Nginx IPV4 问题
    VMWare中CentOS 7 配置 XShell连接
    在CentOS 7 中安装Docker
    Docker for Windows 和虚拟机VMWare共存方案
    Nginx 配置多个站点
  • 原文地址:https://www.cnblogs.com/SQL/p/914257.html
Copyright © 2011-2022 走看看