题解 1059: 二级C语言-等差数列

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

筛选

二级C语言-等差数列

摘要:参考代码1:#include <stdio.h> int fca(int x) {     if (x == 1)     {         return 2;     }   &nbs

二级C语言-等差数列

摘要:解题思路:利用高中学过的等差数列前n项和的公式:n*a+n*(n-1)*d/2即可解。其中a为第一项,d为公差,在这里a=2,d=3.注意事项:参考代码:#include<stdio.h> int m……

等差数列求解

摘要:解题思路:首先求通项,后遍历从1到n之间的每一个数,将这些数代入通项,求和注意事项:循环的起点是i=1,也要注意sum需要有初始值参考代码:#include<stdio.h>int main(){ i……

..................

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int n;    scanf("%d",&n);    printf("%d",n*(3*n+1)/2)……

for循环求解等差数列

摘要:解题思路:利用for循环求解此题即可注意事项:参考代码:#include<iostream>using namespace std;void dfs(int a){    int b = 2;    ……

等差数列求和

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int n,i;    int sum = 0;    int j = 2;    scanf("%d",……

等差数列求和(求和公式)

摘要:解题思路:活用数学中数列的概念以及性质。注意事项:An=a1+(n-1)d//n正好为用户输入Sn=[a1+x(末尾)]*n/2参考代码://等差数列求和 #include <stdio.h>int ……

无聊的星期六

摘要:解题思路:注意事项:参考代码:number = int(input()) sim = 2 total = sum([sim + i * 3 for i in range(number)]) pr……