Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这题真难阿Ac阿,不过总算搞定了

Posted by Alel at 2010-01-21 21:42:58 on Problem 1675
#include<stdio.h>
#include<math.h>
int main()
{
    int r,x[4],y[4],t;
    int i,j;
    double a[4],PI,m,b1,b2,b3,p,max;
    PI=2*acos(0);p=2*PI/3;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&r);
        for(i=1;i<4;i++)scanf("%d%d",&x[i],&y[i]);
        if((x[1]==0&&y[1]==0)||(x[2]==0&&y[2]==0)||(x[3]==0&&y[3]==0)){printf("No\n");continue;}
        for(i=1;i<4;i++)
        {
            a[i]=acos(x[i]/sqrt(x[i]*x[i]+y[i]*y[i]));
            if(y[i]<0)a[i]=2*PI-a[i];
            }
        for(i=1;i<4;i++)
         for(j=i+1;j<4;j++)
         if(a[i]>a[j]){m=a[i];a[i]=a[j];a[j]=m;}
        if((a[1]-a[2])*(a[2]-a[3])*(a[3]-a[1])==0){printf("No\n");continue;}
        b1=a[2]-a[1];b2=a[3]-a[2];b3=2*PI-(a[3]-a[1]);
        max=b1>b2?b1:b2;
        max=max>b3?max:b3;
        if(max>=p&&max<2*p)printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator