栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

poj 2592 Standard Point System

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

poj 2592 Standard Point System

#include <stdio.h>#include <math.h>#include <string.h>#define M 1000000#define PI 3.141592653589793int num[151];double cal(double p){double dx=0.0002,c=1.0/sqrt(2*PI),x0=0,s=0.5,t,m;if (p>=0.5){while(x0<=5&&s<=p){m=x0+dx/2.0;t=exp(-(m*m)/2.0)*dx*c;s=s+t;x0+=dx;}}else{while(x0>=-5&&s>=p){m=x0-dx/2.0;t=exp(-(m*m)/2.0)*dx*c;s=s-t;x0-=dx;}}return x0;}int main(){int i,n,m,sc,j,k,first=1,sp;double p,sp1,x;while(scanf("%d",&n)!=EOF&&n){if (!first) printf("n");first=0;memset(num,0,sizeof(num));for(i=0;i<n;i++){scanf("%d",&sc);num[sc]++;}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d",&sc);k=0;for(j=0;j<sc;j++) k+=num[j];p=k/double(n);x=cal(p);sp1=500.0+100.0*x;if (sp1<=100) sp=100;else if (sp1>100&&sp1<=501) sp=sp1;else if (sp1>501&&sp1<=900){ if (sp1>int(sp1)) sp=sp1+1;else sp=sp1;}else sp=900;printf("%dn",sp);}}return 0;}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/379111.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号