题解 | #等差数列#
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <iostream> using namespace std; int main() { int a, b,c; while (cin >> a ) { // 注意 while 处理多个 case b=2+3*(a-1); c=(2+b)*a/2; } cout<<c; }
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <iostream> using namespace std; int main() { int a, b,c; while (cin >> a ) { // 注意 while 处理多个 case b=2+3*(a-1); c=(2+b)*a/2; } cout<<c; }
相关推荐