QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#558102#9253. Prism PalacezhichengWA 29ms7300kbC++14718b2024-09-11 14:10:552024-09-11 14:10:56

Judging History

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

  • [2024-09-11 14:10:56]
  • 评测
  • 测评结果:WA
  • 用时:29ms
  • 内存:7300kb
  • [2024-09-11 14:10:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=200010;
const double pi=acos(-1);
double a[N];
struct point{
	int x,y;
	double len(){
		return sqrt(x*x+y*y);
	}
}p[N];
point operator-(point a,point b){
	return {a.x-b.x,a.y-b.y};
}
double operator*(point a,point b){
	return a.x*b.x+a.y*b.y;
}
int main(){
	int n;
	double ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
	}
	p[0]=p[n];
	p[n+1]=p[1];
	for(int i=1;i<=n;i++){
		a[i]=acos((p[i-1]-p[i])*(p[i+1]-p[i])/(p[i-1]-p[i]).len()/(p[i+1]-p[i]).len());
	}
	a[0]=a[n];
	a[n+1]=a[1];
	for(int i=1;i<=n;i++){
		if(a[i]+a[i+1]<pi){
			ans+=(pi-a[i]-a[i+1])/pi;
		}
	}
	printf("%.15lf",ans);
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 6100kb

input:

3
0 0
1 0
0 1

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 4088kb

input:

4
0 0
0 1
1 1
1 0

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

4
0 0
0 3
1 2
1 1

output:

0.500000000000000

result:

ok found '0.5000000', expected '0.5000000', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 29ms
memory: 7300kb

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.000000000000000

result:

wrong answer 1st numbers differ - expected: '0.0000777', found: '0.0000000', error = '0.0000777'