QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#834521#9253. Prism PalaceasafoxWA 1ms5872kbC++141006b2024-12-27 19:47:242024-12-27 19:47:24

Judging History

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

  • [2024-12-27 19:47:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5872kb
  • [2024-12-27 19:47:24]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
const int maxn=1e6+10;
const long double pi=acos(-1);
pair<int,int>a[maxn],v[maxn];
bool flag=0;
long double work(int x,int y){
	long double xa=v[x].first;
	long double ya=v[x].second;
	long double xb=v[y].first;
	long double yb=v[y].second;
	long double sn=(xa*yb-ya*xb)/(sqrt(xa*xa+ya*ya)*sqrt(xb*xb+yb*yb));
	if(sn>1.0L) sn=1.0L;
	if(sn<-1.0L) sn=-1.0L;
	long double sita=asin(sn);
	if(sita>0) sita=0;
	else{
		printf("%Lf %Lf %Lf %Lf ->",xa,ya,xb,yb);
	}
	return -sita;
}
long double ans=0;
int main(){
	scanf("%d",&n);
	if(n==199996){
		flag=1;
	}
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].first,&a[i].second);
	}
	a[n+1]=a[1];
	a[0]=a[n];
	for(int i=1;i<=n;i++){
		v[i].first=a[i+1].first-a[i].first;
		v[i].second=a[i+1].second-a[i].second;
	}	
	for(int i=1;i<=n-2;i++){
		ans+=work(i,i+2);
	}
	ans+=work(n-1,1);
	ans+=work(n,2);
//	cout<<ans<<endl;
	printf("%.9Lf",ans/pi);
	return 0;
}
/*


*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5872kb

input:

3
0 0
1 0
0 1

output:

1.000000 0.000000 0.000000 -1.000000 ->-1.000000 1.000000 1.000000 0.000000 ->0.000000 -1.000000 -1.000000 1.000000 ->1.000000000

result:

wrong output format Extra information in the output file