博客
关于我
2018蓝桥杯C++A组——付账问题
阅读量:111 次
发布时间:2019-02-26

本文共 1242 字,大约阅读时间需要 4 分钟。

????

????????????????????????????????????????? n ????????? S???????????????????????????????

??

?????????

  • ??????????n ? S????????????????
  • ??????? n ?????????????

??

?????????????????????

????

5 2333666 666 666 666 666 666

????

0.0000

????

???????????????????????????????????????????????????????????????????

[ s = \sqrt{\frac{1}{n} \sum_{i=1}^{n} \left(b_i - \frac{1}{n} \sum_{i=1}^{n} b_i \right)^2} ]

???( s ) ?????( b_i ) ?????????( n ) ?????????

???????????????????????????????????????????????????????????????

  • ?????????????? ( \mu = \frac{S}{n} )?
  • ???????????????
  • ?????
    • ??????????????????????
    • ???????????????????????????????????????? cur_avg??? cur_avg ??????????
  • ???????????????????????????????????

    C++??

    #include 
    using namespace std;typedef long long LL;int n;LL S;double ans = 0.0;double avg = 1.0 * S / n;LL *a = new LL[n];void work() { scanf("%d %lld", &n, &S); ans = 0.0; avg = 1.0 * S / n; LL *a = new LL[n]; for (int i = 0; i < n; ++i) { scanf("%lld", &a[i]); } // ????? double sum = 0.0; for (int i = 0; i < n; ++i) { double diff = a[i] - avg; sum += diff * diff; } ans = sqrt(sum / n); printf("%.4f", ans);}

    ??

    ????????????????

    0.0000

    ???????????????????? 0.0000?

    转载地址:http://swqu.baihongyu.com/

    你可能感兴趣的文章
    python系列【仅供参考】:python二进制转10进制
    查看>>
    Python基础-函数篇
    查看>>
    python基础---->常用模块
    查看>>
    Python基础(2):控制结构
    查看>>
    Python基础 | 关于“循环”那些事
    查看>>
    python系列【仅供参考】:python之subprocess模块rsync拉取文件
    查看>>
    python系列【仅供参考】:python 远程rdp
    查看>>
    python基础
    查看>>
    Python基本语法与变量类型
    查看>>
    python基本数据类型(容器)- tuple list dict set
    查看>>
    python基本工资的调整方案_Python薪资又涨了!这可咋办!
    查看>>
    Python基准测试和性能分析内存管理和垃圾回收
    查看>>
    Python基于RESTful风格的接口自动化测试实战
    查看>>
    python基于pygame实现跨年烟花效果
    查看>>
    python基于flask搭建http服务(四)—— Docker容器化部署
    查看>>
    python基于flask搭建http服务(二)—— 实现Excel上传、数据清洗、入库
    查看>>
    python基于flask搭建http服务(三)—— 使用gunicorn部署项目
    查看>>
    python基于flask搭建http服务(一)—— 实现数据查询和Excel导出
    查看>>
    Python块键盘/鼠标输入
    查看>>
    Python在正确的时区获取当前时间
    查看>>