当前位置:网站首页>7-4 harmonic average
7-4 harmonic average
2022-07-06 16:43:00 【HBUcs2020】
Record a very stupid mistake
n-- after n Finally changed to 0, I still use n To divide
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
double sum=0;
int a=n;
while(n--)
{
double x;
cin>>x;
//printf(" %lf %lf\n",1/x,sum);
sum+=1/x;
}
//sum=sum/n;
//printf("%lf\n",sum/n);
printf("%.2f",1.0/(sum/a));
return 0;
}
边栏推荐
- Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
- Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
- 第7章 __consumer_offsets topic
- js时间函数大全 详细的讲解 -----阿浩博客
- Research Report on market supply and demand and strategy of China's four flat leadless (QFN) packaging industry
- Chapter 5 detailed explanation of consumer groups
- <li>圆点样式 list-style-type
- Acwing: the 56th weekly match
- Kubernetes集群部署
- 图像处理一百题(11-20)
猜你喜欢
第五章 Yarn资源调度器
(lightoj - 1323) billiard balls (thinking)
Installation and configuration of MariaDB
Use JQ to realize the reverse selection of all and no selection at all - Feng Hao's blog
Cmake Express
简单尝试DeepFaceLab(DeepFake)的新AMP模型
Submit several problem records of spark application (sparklauncher with cluster deploy mode)
< li> dot style list style type
ffmpeg命令行使用
Two weeks' experience of intermediate software designer in the crash soft exam
随机推荐
Codeforces Round #771 (Div. 2)
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
Study notes of Tutu - process
Spark independent cluster dynamic online and offline worker node
FLV格式详解
sublime text 代码格式化操作
QT implementation fillet window
Cmake Express
Codeforces Round #799 (Div. 4)A~H
LeetCode 1545. Find the k-th bit in the nth binary string
解决Intel12代酷睿CPU单线程调度问题(二)
第5章 消费者组详解
QT style settings of qcobobox controls (rounded corners, drop-down boxes, up expansion, editable, internal layout, etc.)
Pull branch failed, fatal: 'origin/xxx' is not a commit and a branch 'xxx' cannot be created from it
Codeforces Round #800 (Div. 2)AC
Input can only input numbers, limited input
Spark的RDD(弹性分布式数据集)返回大结果集
第5章 NameNode和SecondaryNameNode
QT simulates mouse events and realizes clicking, double clicking, moving and dragging
Tencent interview algorithm question