题解 | #等差数列#
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <stdio.h> int main() { int a,b,n,all; scanf("%d",&n); all=0; for(a=1;a<=n;a++) { all=all+3*a-1; } printf("%d",all); return 0; }
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <stdio.h> int main() { int a,b,n,all; scanf("%d",&n); all=0; for(a=1;a<=n;a++) { all=all+3*a-1; } printf("%d",all); return 0; }
相关推荐