题解 2822: 求分数序列和

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

题解 2822: 求分数序列和

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int main(){ int n; double a=1.0,b=2.0,c=0;……

2822两种思路c++

摘要:思路1 从第一项开始#include <iostream>#include <iomanip>using namespace std;int main() { int fz =……

2025/8/3刷题记录

摘要:解题思路:通过sum记录累加和 int c记录原始b b=a+b后保证 a能赋值原始b注意事项:参考代码:#include<stdio.h>int main(){ ……

注意q和p不能放在整数型里

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int i,n;    double Sn=0,q=2.0,p=1.0;    scanf("%d",&n……

求分数序列和

摘要:解题思路:注意事项:参考代码:n = int(input())q = 2p = 1s = 0for i in range(n):    s += q/p    t = q    q = p + q  ……

2822: 求分数序列和

摘要:参考代码:n = int(input()) p, q = 1, 2 sum = 0 for _ in range(n):     sum += q / p     flag = q    ……

编写题解 2822: 求分数序列和

摘要:解题思路:注意事项:参考代码:n=int(input())sum=0#分数之和p_list=[1]q_list=[2]for i in range(n):        q_list.append(p……

2822: 求分数序列和

摘要:解题思路:注意事项:参考代码:#include#includeusing namespace std; double molecule(int n) {     if(n==1)       ……

求分数序列和(辗转相除法?)

摘要:注意事项: 规律:p/q,p+q/p ……,这么一个规律,用辗转相除法就很好做了,第一次接触这个方法,还是在求最大公约数和最小公倍数,不记得了的xd,可以回去看看 参考代码: ```c #i……