高职高考数学知识点数列:等差数列的通项公式_哔哩哔哩_bilibili
- /*
- 电子协会 C语言 1级 30 、 等差数列末项计算
- http://noi.openjudge.cn/math/7654/
- http://noi.openjudge.cn/ch0103/18/
- 给出一个等差数列的前两项 a1,a2,求第 n 项是多少。
- 输入
- 一行,包含三个整数 a1,a2,n。-100 <= a1,a2 <= 100,0 < n <= 1000。
- 输出
- 一个整数,即第 n 项的值。
- 样例输入:1 4 100
- 样例输出:298
- 3 6 9 12 15
- 高职高考数学知识点数列:等差数列的通项公式
- https://www.bilibili.com/video/BV13U4y1p7ec
- */
- #include<iostream>
- using namespace std;
- int main()
- {
- int a1,a2,an,n;
-
- cin>>a1>>a2>>n;
-
- //公差d=a2-a1=a3-a2=a4-a3=an-an-1
-
- an=a1+(n-1)*(a2-a1);//等差数列通项公式
-
- cout<<an;
-
- return 0;
- }
- /*
- 电子协会 C语言 1级 30 、 等差数列末项计算 方法二
- http://noi.openjudge.cn/math/7654/
- http://noi.openjudge.cn/ch0103/18/
- 1047:判断能否被3,5,7整除---好
- https://blog.csdn.net/weixin_43877387/article/details/118456563
- */
- #include<iostream>
- using namespace std;
- int main()
- {
-
- int a1,a2,n,d;
-
- cin>>a1>>a2>>n;
-
- d=a2-a1;
-
- cout<<a1+(n-1)*d;
-
- return 0;
- }
- a1,a2,n=map(int,input().split())
-
- d=a2-a1
-
- an=a1+(n-1)*d
-
- print(an)
https://blog.csdn.net/dllglvzhenfeng/category_11735875.html
高职高考数学知识点数列:等差数列的通项公式_哔哩哔哩_bilibili
电子协会 青少年软件编程等级考试 C语言历年真题_dllglvzhenfeng的博客-CSDN博客
电子协会C语言 真题与模拟题_dllglvzhenfeng的博客-CSDN博客
电子协会 C语言 1级 5 、判断能否被 3 ,5 ,7 整除_dllglvzhenfeng的博客-CSDN博客
电子协会 C语言 1级 6 、骑车与走路_dllglvzhenfeng的博客-CSDN博客
电子协会 C语言 1级 7 、画矩形_dllglvzhenfeng的博客-CSDN博客
电子协会 C语言 1级 18 、计算邮资_dllglvzhenfeng的博客-CSDN博客_csp试题
电子协会 C语言 1级 19 、求整数的和与均值_dllglvzhenfeng的博客-CSDN博客_电子学会c语言一级
电子协会 C语言 1级 21 、逻辑判断问题 输入三个数 a,b,c,输出最大者_dllglvzhenfeng的博客-CSDN博客
电子协会 C语言 1级 23 、判断平闰年_dllglvzhenfeng的博客-CSDN博客