zoukankan      html  css  js  c++  java
  • 今天HNU的比赛 11003

    我郁闷 交了第五次才过....
    第一次是CE........头文件乱七八糟混用 ....还自己声明了个与内部变量冲突的count.....
    后面的错误发现.....在大于180度需要减360的时候,我把弧度当角度了...=_=
    再后来本来要减360...我用360减了.....
    第五次AC...~~~
    不过比赛中这题就我们过了....nice~~~其实是一道水几何题.....
    #include<math.h>
    #include 
    <stdio.h>

    struct Point
    {
        
    double x;
        
    double y;
    }
    ;

    int n;
    Point came;
    Point point[
    50000];
    double agle;
    double ag;
    int cnt;



    double angel(double x,double y)
    {
        
    double c=sqrt(x*x+y*y);
        
    double d;
        
    if(x<=0)
        
    {
             d
    =360-acos(y/c)/(2*acos(-1.0))*360;
            
        }

        
    else
        
    {
            d
    = (acos(y/c))/(2*acos(-1.0))*360;
        }

        
    if(d>=360-(1e-7))
            
    return d-360;
        
    else
            
    return d;

    }



    int cacul(double a)
    {
        
    int cou=0;
        
    for(int i=0;i<n;i++)
        
    {
            
    double a1=angel((point[i].x-came.x), (point[i].y-came.y));
            
    double a2=a;
            
    if(a1-a2>180.0)
                a1
    =a1-360.0;
            
    if(a2-a1>180.0)
                a2
    =a2-360.0;
            
    if( (a1-a2>=0.0 && a1-a2<agle/2.0|| (a2-a1>=0.0 && a2-a1<agle/2.0))
                cou
    ++;
        }

        
    return cou;
    }


    void func()
    {
        cnt 
    = 0;
        
    double a=0.0;
        
    while(a<=3599)
        
    {
            
    int hold=cacul(a/10.0);
            
    if(cnt<hold)
            
    {
                cnt
    =hold;
                ag
    =a/10.0;
            }

            a
    +=1;
        }

    }



    int main()
    {
        
    while(scanf("%d",&n)!=EOF)
        
    {
            
    if(n==0)
                
    break;
            scanf(
    "%lf%lf%lf"&came.x, &came.y, &agle);
            
    for(int i=0;i<n;i++)
                scanf(
    "%lf%lf"&point[i].x, &point[i].y);
            func();
            printf(
    "Point the camera at angle %.1lf to view %d infested trees.\n", ag, cnt);
        }

        
    return 0;
    }
  • 相关阅读:
    Sample XPS Documents Download
    触发器中的inserted表和deleted表
    Using freewheel.labs.autodesk.com to auto generate preview images of DWF files on your web site
    解除SQL对组件"Ad Hoc Distributed Queries"的"STATEMENT'OpenRowset OpenDatasource"的访问
    读写xps
    XPS文件,在Windows XP下的打开查看阅读和打印方法。
    Learning to Reference Inserted and Deleted Tables
    Get value from updated, inserted and deleted
    Reinstall Microsoft Helper Viewer
    如何查找文件的IFilter
  • 原文地址:https://www.cnblogs.com/SQL/p/892952.html
Copyright © 2011-2022 走看看