当前位置:网站首页>One book 1078: sum of fractional sequences
One book 1078: sum of fractional sequences
2022-07-02 07:47:00 【Studying hard】
【 Title Description 】
There's a sequence of fractions q1/p1,q2/p2,q3/p3,q4/p4,q5/p5,...., among qi+1=qi+pi, pi+1=qi,p1=1,q1=2. For example, before this sequence 6 The items are 2/1,3/2,5/3,8/5,13/8,21/13. Find the first... Of this sequence of fractions n Sum of items .
【 Input 】
Input has one line , Contains a positive integer n(n≤30).
【 Output 】
The output has a line , Contains a floating-point number , Indicates the number before the score sequence nn Sum of items , Accurate to the decimal point
4 position .
【 sample input 】
2【 sample output 】
3.5000#include<stdio.h> int main() { int n; scanf("%d", &n); int dp[100]; dp[1] = 1; dp[2] = 2; int i; for (i = 3; i <= n + 1; i++) { dp[i] = dp[i - 1] + dp[i - 2]; } double num = 0; for (i = 2; i <= n + 1; i++) { num += dp[i]*1.0000 / dp[i - 1]; } printf("%.4f", num); return 0; }
边栏推荐
- Implementation of yolov5 single image detection based on pytorch
- The difference and understanding between generative model and discriminant model
- What if the notebook computer cannot run the CMD command
- Play online games with mame32k
- 传统目标检测笔记1__ Viola Jones
- 【Random Erasing】《Random Erasing Data Augmentation》
- Mmdetection trains its own data set -- export coco format of cvat annotation file and related operations
- win10+vs2017+denseflow编译
- Label propagation
- 论文写作tip2
猜你喜欢

【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization

Common CNN network innovations

【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》

【TCDCN】《Facial landmark detection by deep multi-task learning》

How to turn on night mode on laptop

Timeout docking video generation
![[introduction to information retrieval] Chapter 7 scoring calculation in search system](/img/cc/a5437cd36956e4c239889114b783c4.png)
[introduction to information retrieval] Chapter 7 scoring calculation in search system

【FastDepth】《FastDepth:Fast Monocular Depth Estimation on Embedded Systems》

Machine learning theory learning: perceptron

图片数据爬取工具Image-Downloader的安装和使用
随机推荐
Mmdetection installation problem
Implement interface Iterable & lt; T&gt;
常见的机器学习相关评价指标
自然辩证辨析题整理
ABM论文翻译
Convert timestamp into milliseconds and format time in PHP
Interpretation of ernie1.0 and ernie2.0 papers
【Paper Reading】
使用百度网盘上传数据到服务器上
【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
【FastDepth】《FastDepth:Fast Monocular Depth Estimation on Embedded Systems》
超时停靠视频生成
传统目标检测笔记1__ Viola Jones
Timeout docking video generation
【AutoAugment】《AutoAugment:Learning Augmentation Policies from Data》
Jordan decomposition example of matrix
Optimization method: meaning of common mathematical symbols
【Mixup】《Mixup:Beyond Empirical Risk Minimization》
Use matlab to realize: chord cut method, dichotomy, CG method, find zero point and solve equation
Tencent machine test questions