QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#725366 | #9576. Ordainer of Inexorable Judgment | ucup-team1338 | WA | 0ms | 4336kb | C++23 | 1.9kb | 2024-11-08 17:20:15 | 2024-11-08 17:20:15 |
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:20:15]
- 提交
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;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4336kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.000000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4232kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.570796326794897
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4200kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.707752257475477
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4284kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.384241300290388
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 4200kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
2499.455171841210813
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '2499.4551718', error = '0.0003142'