当前位置:网站首页>[luogu_p4820] [national training team] stack [mathematics] [physics] [harmonic progression]
[luogu_p4820] [national training team] stack [mathematics] [physics] [harmonic progression]
2022-07-27 13:57:00 【VL——MOESR】

Ideas :
First, through physical knowledge , We know it's a request
m 2 ∗ ( 1 + 1 2 + 1 4 + 1 6 … … + 1 n ) \frac{m}{2}*(1+\frac{1}{2}+\frac{1}{4}+\frac{1}{6}……+\frac{1}{n}) 2m∗(1+21+41+61……+n1)
This thing inside is destroyed by harmonic series .
Note that the final answer is not available , So take one down
c o d e code code
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const double eps = 1e-6;
const double euler = 0.5772156649015328;
long long n, m;
int main() {
scanf("%lld%lld", &n, &m);
if(n<=1e7) {
double s=0;
for(int i = 1; i <= n; i ++)
s=s+(1.0/i);
cout<<round(s * m / 2 - 0.5 - eps);
}
else {
double s = (log(n) + euler) * m / 2 - 0.5 - eps;
cout<<round(s);
}
return 0;
}
边栏推荐
- 2022ACM夏季集训周报(四)
- Zoom, translation and rotation of OpenCV image
- UTNet 用于医学图像分割的混合Transformer
- 软考 系统架构设计师 简明教程 | 软件系统建模
- Wechat campus laundry applet graduation design finished product (4) opening report
- Wechat campus laundry applet graduation design finished product (5) assignment
- PCL common operations
- 【每日一题】1206. 设计跳表
- Redis cluster setup - use docker to quickly build a test redis cluster
- 剑指Offer 07 重建二叉树 -- 从中序与后序遍历序列构造二叉树
猜你喜欢

Go language series: how to build a go language development environment?

认知篇----硬件工程师的成才之路之经典

Sword finger offer II 041. Average value of sliding window

【idea】设置提取serialVersionUID

SQL教程之 SQL 聚合函数入门教程

Application layer World Wide Web WWW

Use recyclerview to realize the left sliding menu of the list

不需要标注数据的语义分割!ETH&鲁汶大学提出MaskDistill,用Transformer来进行无监督语义分割,SOTA!...

13、用户web层服务(一)

Image features and extraction
随机推荐
English grammar_ Personal pronoun
软考 系统架构设计师 简明教程 | 软件测试
ThinkPHP+宝塔运营环境实现定时任务
小程序毕设作品之微信校园洗衣小程序毕业设计成品(5)任务书
Experience sharing of system architecture designers preparing for the exam: a tough battle for nearly three months
[C Advanced] pointer array vs array pointer
Hcip - OSPF comprehensive experiment
【每日一题】1206. 设计跳表
MySQL high availability practical solution MHA
NoSQL —— NoSQL 三大理论基石 —— CAP —— BASE—— 最终一致性
Summary of scaling and coding methods in Feature Engineering
SQL tutorial: introduction to SQL aggregate functions
基于C语言实现线性表的建立、插入、删除、查找等基本操作
Leetcode error reporting and its solution
【实习经验】Date工具类中添加自己实现的方法
期货手续费标准和保证金比例
Construction and application of industrial knowledge atlas (2): representation and modeling of commodity knowledge
在“元宇宙空间”UTONMOS将打开虚实结合的数字世界
Recommended collection, confusing knowledge points of PMP challenge (2)
2. Citrix virtual apps and desktops 2203 clipboard redirection policy