BZOJ1011 [HNOI2008]遥远的行星 【浮点数估算】

tonyfang posted @ 2015年8月29日 16:44 in BZOJ with tags c++ OI , 455 阅读

浮点数估算。

前面250个暴力,后面几个用平均数+前缀和乱搞……

真是人有多大胆地有多大产

 

# include <stdio.h>
# include <math.h>
using namespace std;
int n;
double m[100010],s[100010],f[100010],a;
const int eps=1e-7;
int main() {
	scanf("%d%lf",&n,&a);
	for(int i=1;i<=n;++i)scanf("%lf",&m[i]),s[i]=s[i-1]+m[i];
	int p=n>250?250:n;
	for(int i=1;i<=p;++i) {
		int x=floor(a*i+eps);
		for (int j=1;j<=x;++j) f[i]+=(m[j]*m[i])/(i-j)+eps;
	}
	for (int i=p+1;i<=n;++i) {
		int x=floor(a*i+eps);
		f[i]=s[x]*m[i]/(i-(1+x)/2)+eps;
	}
	for (int i=1;i<=n;++i) printf("%.6lf\n",f[i]);
	return 0;
}
हिन्दी-सवाल-पत्रों.c 说:
2023年4月26日 15:55

Hindi Model Question Papers Bihar School 10th Exam Board BSEB, Bihar Board 10th Class Model Papers 2023 Matric Exam Pattern, BSEB Patna Board Matric 10th Model Papers 2023 Sample Questions, Bihar Board 10th Model Papers 2023 Download, हिन्दी-सवाल-पत्रों.com BSEB Matric Bihar matric model paper 2023 bseb 10th sample paper 2023, bihar board 10th model paper 2023 pdf, bihar board 10th class model test paper 2023, bseb matric previous sample paper class 10th bihar board model question paper, bseb matric model question paper 2023.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter