当前位置:网站首页>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;
}
边栏推荐
- Tencent interview algorithm question
- 业务系统从Oracle迁移到openGauss数据库的简单记录
- 使用jq实现全选 反选 和全不选-冯浩的博客
- Hbuilder x format shortcut key settings
- LeetCode 1447. Simplest fraction
- Chapter 1 overview of MapReduce
- Cmake Express
- Remove the border when input is focused
- Research Report on market supply and demand and strategy of China's tetraacetylethylenediamine (TAED) industry
- QT style settings of qcobobox controls (rounded corners, drop-down boxes, up expansion, editable, internal layout, etc.)
猜你喜欢
Kubernetes cluster deployment
MP4格式详解
It is forbidden to trigger onchange in antd upload beforeupload
Chapter 1 overview of MapReduce
ByteDance new programmer's growth secret: those glittering treasures mentors
Browser print margin, default / borderless, full 1 page A4
Submit several problem records of spark application (sparklauncher with cluster deploy mode)
Native JS realizes the functions of all selection and inverse selection -- Feng Hao's blog
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
Mp4 format details
随机推荐
OneForAll安装使用
One hundred questions of image processing (11-20)
第一章 MapReduce概述
Educational Codeforces Round 122 (Rated for Div. 2)
Codeforces Round #771 (Div. 2)
Market trend report, technological innovation and market forecast of double door and multi door refrigerators in China
业务系统从Oracle迁移到openGauss数据库的简单记录
Li Kou - 298th weekly match
(POJ - 3186) treatments for the cows (interval DP)
Research Report on market supply and demand and strategy of China's four seasons tent industry
去掉input聚焦时的边框
第五章 Yarn资源调度器
力扣leetcode第 280 场周赛
The concept of spark independent cluster worker and executor
Summary of game theory
Tert butyl hydroquinone (TBHQ) Industry Research Report - market status analysis and development prospect forecast
Click QT button to switch qlineedit focus (including code)
Study notes of Tutu - process
(lightoj - 1354) IP checking (Analog)
Codeforces round 797 (Div. 3) no f