#Z0004. 等差数列
等差数列
题目描述
给出n个整数a1,a2,a3...,an,如果对于任意的i(2<=i<=n),ai-a(i-1)都相等,称这列数为“等差数列”。现在给出一个等差数列的前两项a1,a2,求第n项的值为多少?
输入格式
一行三个整数a1,a2和n,之间用一个空格隔开。其中,,-100<=a1,a2<=100,1<=n<=1000.
输出格式
一行一个整数,即第n项的值
1 4 100
298
给出n个整数a1,a2,a3...,an,如果对于任意的i(2<=i<=n),ai-a(i-1)都相等,称这列数为“等差数列”。现在给出一个等差数列的前两项a1,a2,求第n项的值为多少?
一行三个整数a1,a2和n,之间用一个空格隔开。其中,,-100<=a1,a2<=100,1<=n<=1000.
一行一个整数,即第n项的值
1 4 100
298
By signing up a 战码少年-战码青少年编程(专业信息学奥赛编程训练) universal account, you can submit code and join discussions in all online judging services provided by us.