当前位置:网站首页>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;
}边栏推荐
- Educational Codeforces Round 122 (Rated for Div. 2)
- (lightoj - 1370) Bi shoe and phi shoe (Euler function tabulation)
- js封装数组反转的方法--冯浩的博客
- 第5章 消费者组详解
- 解决Intel12代酷睿CPU单线程调度问题(二)
- Story of [Kun Jintong]: talk about Chinese character coding and common character sets
- Anaconda下安装Jupyter notebook
- Research Report on market supply and demand and strategy of China's four seasons tent industry
- It is forbidden to trigger onchange in antd upload beforeupload
- LeetCode 1560. The sector with the most passes on the circular track
猜你喜欢

Chapter 5 namenode and secondarynamenode

OneForAll安装使用

Ffmpeg command line use

提交Spark应用的若干问题记录(sparklauncher with cluster deploy mode)

Codeforces Round #799 (Div. 4)A~H

Basic principles of video compression coding and audio compression coding

第5章 NameNode和SecondaryNameNode

Advancedinstaller installation package custom action open file

Local visualization tools are connected to redis of Alibaba cloud CentOS server

第2章 HFDS的Shell操作
随机推荐
sublime text 代码格式化操作
Educational Codeforces Round 122 (Rated for Div. 2)
Research Report on market supply and demand and strategy of China's four seasons tent industry
(lightoj - 1370) Bi shoe and phi shoe (Euler function tabulation)
Audio and video development interview questions
Kubernetes cluster deployment
(lightoj - 1323) billiard balls (thinking)
QT implementation window gradually disappears qpropertyanimation+ progress bar
ffmpeg命令行使用
< li> dot style list style type
Pull branch failed, fatal: 'origin/xxx' is not a commit and a branch 'xxx' cannot be created from it
LeetCode 1984. Minimum difference in student scores
OneForAll安装使用
Log statistics (double pointer)
It is forbidden to trigger onchange in antd upload beforeupload
Install Jupiter notebook under Anaconda
LeetCode 1552. Magnetic force between two balls
Kubernetes集群部署
Chapter 7__ consumer_ offsets topic
Tree of life (tree DP)