QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#18428#2267. Jewelry Sizeguobo#WA 9ms3720kbC++1.3kb2022-01-19 17:38:082022-05-06 01:04:34

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-06 01:04:34]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:3720kb
  • [2022-01-19 17:38:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> PII;
const int maxn=111111,mod=998244353;
const ld PI=3.14159265358979323846;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
inline int qpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
int n;
ld a[maxn];
inline ld calc(ld x,int tp){
	ld s=0;
	FOR(i,1,n){
		ld y=1-a[i]*a[i]/2/x/x,z=acos(y);
		s+=z*(i==n?tp:1);
	}
	return s;
}
int main(){
//	n=read();
//	FOR(i,1,n) a[i]=read();
//	sort(a+1,a+n+1);
	n=1000;
	FOR(i,1,n-1) a[i]=6;
	a[n]=5993;
	ld l=a[n]/2,r=1e9;
	if(calc(l,1)>=2*PI){
		FOR(_,1,100){
			ld mid=(l+r)/2;
			if(calc(mid,1)<2*PI) r=mid;
			else l=mid;
		}
		printf("%.8lf\n",(double)l);
	}
	else{
		FOR(_,1,100){
			ld mid=(l+r)/2;
			if(calc(mid,-1)<0) l=mid;
			else r=mid;
		}
		printf("%.8lf\n",(double)l);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 3720kb

input:

5
3 1 6 1 7

output:

94723.64340422

result:

wrong answer 1st numbers differ - expected: '3.5444044', found: '94723.6434042', error = '26723.8411936'