题解 | #等差数列#直接带公式就行#C语言
等差数列
http://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include<stdio.h> int main() { int n,y,z; while(scanf("%d",&n)!=EOF) { y=2+3*(n-1); z=(2+y)*n/2; printf("%d\n",z); } return 0; }
等差数列
http://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include<stdio.h> int main() { int n,y,z; while(scanf("%d",&n)!=EOF) { y=2+3*(n-1); z=(2+y)*n/2; printf("%d\n",z); } return 0; }
相关推荐