QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#575908 | #9253. Prism Palace | Auroraa | AC ✓ | 46ms | 14148kb | C++20 | 1.0kb | 2024-09-19 17:16:58 | 2024-09-19 17:16:59 |
Judging History
answer
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
#define int long long
const int N=1e6+5;
#define double long double
struct Point{
int x,y;
int dis2(const Point&a)const{
return (x-a.x)*(x-a.x)+(y-a.y)*(y-a.y);
}
double dis(const Point&a)const{
return sqrt(dis2(a));
}
}p[N];
const double pi=acos(-1);
double ang[N];
void solve(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>p[i].x>>p[i].y;
}
for(int i=0;i<n;i++){
int a2=p[i].dis2(p[(i-1+n)%n]),b2=p[i].dis2(p[(i+1)%n]),c2=p[(i-1+n)%n].dis2(p[(i+1)%n]);
double a=sqrt(a2),b=sqrt(b2);
ang[i]=acos((a2+b2-c2)/(2.0l*a*b));
}
double ans=0;
for(int i=0;i<n;i++){
ans+=max(0.l,pi-ang[i]-ang[(i+1)%n]);
}
cout<<fixed<<setprecision(10)<<ans/pi<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int Te=1;
// cin>>Te;
while(Te--){
solve();
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5920kb
input:
3 0 0 1 0 0 1
output:
1.0000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5912kb
input:
4 0 0 0 1 1 1 1 0
output:
0.0000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5992kb
input:
4 0 0 0 3 1 2 1 1
output:
0.5000000000
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 46ms
memory: 14148kb
input:
199996 719157942 80035870 719158808 80033199 719160795 80027070 719162868 80020675 719165635 80012139 719166422 80009711 719166927 80008153 719168388 80003645 719168539 80003179 719168806 80002355 719168864 80002176 719169119 80001389 719171067 79995376 719173806 79986921 719175195 79982633 71917686...
output:
0.0000777168
result:
ok found '0.0000777', expected '0.0000777', error '0.0000000'
Test #5:
score: 0
Accepted
time: 44ms
memory: 14016kb
input:
199999 521578765 315995242 521578784 315995230 521585008 315991299 521590377 315987908 521597318 315983524 521606119 315977965 521610976 315974897 521614329 315972779 521622922 315967351 521631939 315961655 521636172 315958981 521638241 315957674 521643115 315954595 521650976 315949629 521656567 315...
output:
0.0000965322
result:
ok found '0.0000965', expected '0.0000965', error '0.0000000'
Test #6:
score: 0
Accepted
time: 39ms
memory: 12548kb
input:
200000 88808852 208512084 88810113 208513562 88812008 208515783 88812543 208516410 88816806 208521406 88824507 208530431 88825624 208531740 88831723 208538887 88834262 208541862 88838287 208546578 88845440 208554959 88848801 208558897 88855564 208566821 88856869 208568350 88862876 208575388 88868324...
output:
0.0000743737
result:
ok found '0.0000744', expected '0.0000744', error '0.0000000'
Test #7:
score: 0
Accepted
time: 39ms
memory: 13232kb
input:
199998 2857588 37580055 2857908 37582176 2857951 37582461 2858026 37582958 2859295 37591366 2859678 37593903 2860879 37601857 2862301 37611272 2862330 37611464 2863054 37616255 2864429 37625353 2865434 37632002 2865585 37633001 2867092 37642971 2867321 37644486 2867870 37648118 2868343 37651247 2868...
output:
0.0000675397
result:
ok found '0.0000675', expected '0.0000675', error '0.0000000'
Test #8:
score: 0
Accepted
time: 35ms
memory: 12940kb
input:
199999 487716180 333296644 487720319 333294576 487721706 333293883 487731571 333288954 487734599 333287441 487742738 333283374 487744419 333282534 487746174 333281657 487748301 333280594 487750462 333279514 487754846 333277323 487759670 333274912 487762097 333273699 487764676 333272410 487772963 333...
output:
0.0000706967
result:
ok found '0.0000707', expected '0.0000707', error '0.0000000'
Extra Test:
score: 0
Extra Test Passed