QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725365#9576. Ordainer of Inexorable Judgmentucup-team1338#Compile Error//C++231.9kb2024-11-08 17:19:482024-11-08 17:19:50

Judging History

你现在查看的是最新测评结果

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-14 21:58:28]
  • hack成功,自动添加数据
  • (/hack/1181)
  • [2024-11-08 17:19:50]
  • 评测
  • [2024-11-08 17:19:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
struct point{
	double x,y,rd;
	void in(){scanf("%lf %lf",&x,&y);}
	void out(){printf("%lf %lf\n",x,y);}
	point(double xx=0,double yy=0){x=xx,y=yy;}
	point operator + (const point& a)const{return point(x+a.x,y+a.y);}
	point operator - (const point& a)const{return point(x-a.x,y-a.y);}
	double operator *(const point& a)const{return x*a.x+y*a.y;}
	double operator ^(const point& a)const{return x*a.y-y*a.x;}
	bool operator < (const point& a)const{return rd<a.rd;}
};
double len(const point& a){return sqrt(a*a);}
double rad(const point& a){return atan2(a.y,a.x);}
const int maxn=105;
point p[maxn];
double cal(double t,double l,double r)
{
	double w=(r-l);
	if(w<0) w+=2*pi;
	double ans=(int)(t/(2*pi))*w;
	t-=(int)(t/(2*pi))*2.0*pi;
	if(l<r)
	{	
		return ans+max(0.0,min(t,r)-l);	
	}
	else 
	{
		return ans+max(t-l,0.0)+min(t,r);
	}
}
int main()
{
	//printf("%lf",asin(1/sqrt(5)));
	int n;point s;double d,t;
	scanf("%d",&n);s.in();scanf("%lf %lf",&d,&t);
	for(int i=1;i<=n;i++) p[i].in();
	for(int i=1;i<=n;i++) p[i].rd=rad(p[i]);
	sort(p+1,p+1+n);
	double l,r;
	//printf("%lf %lf \n",p[1].rd,p[n].rd);
	if(p[n].rd-p[1].rd<pi)
	{
		l=1e9;
		r=-1e9;
		for(int i=1;i<=n;i++)
		{
			double di=asin(d/len(p[i]));
			l=min(l,p[i].rd-di);
			r=max(r,p[i].rd+di);
		}
	}
	else
	{
		int pos1=n,pos2=1;
		l=1e9,r=-1e9;
		for(int i=1;i<=n;i++)
		{
			double di=asin(d/len(p[i]));
			double d1=p[i].rd-di;
			if(d1>pi)d1-=2*pi;
			if(d1<-pi)d1+=2*pi
			if(d1>0) l=min(l,d1);
			else r=max(r,d1);
			double d2=p[i].rd-di;
			if(d2>pi)d1-=2*pi;
			if(d2<-pi)d1+=2*pi
			if(d2>0) l=min(l,d2);
			else r=max(r,d2);
		}
	}
	if(l>=2*pi) l-=2*pi;
	if(r>=2*pi) r-=2*pi;
	if(l<0) l+=2*pi;
	if(r<0) r+=2*pi;
	printf("%.15lf\n",cal(rad(s)+t,l,r)-cal(rad(s),l,r));
	return 0;
} 

Details

answer.code: In function ‘int main()’:
answer.code:64:43: error: expected ‘;’ before ‘if’
   64 |                         if(d1<-pi)d1+=2*pi
      |                                           ^
      |                                           ;
   65 |                         if(d1>0) l=min(l,d1);
      |                         ~~                 
answer.code:69:43: error: expected ‘;’ before ‘if’
   69 |                         if(d2<-pi)d1+=2*pi
      |                                           ^
      |                                           ;
   70 |                         if(d2>0) l=min(l,d2);
      |                         ~~                 
answer.code:38:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |         scanf("%d",&n);s.in();scanf("%lf %lf",&d,&t);
      |         ~~~~~^~~~~~~~~
answer.code:38:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |         scanf("%d",&n);s.in();scanf("%lf %lf",&d,&t);
      |                               ~~~~~^~~~~~~~~~~~~~~~~
answer.code: In member function ‘void point::in()’:
answer.code:6:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         void in(){scanf("%lf %lf",&x,&y);}
      |                   ~~~~~^~~~~~~~~~~~~~~~~