题解 | #规律数列求和#
规律数列求和
https://www.nowcoder.com/practice/e05d1c142b3d4898be7183289a00ce5f
#include <iostream> #include<cmath> using namespace std; int main() { // write your code here...... long long sum = 0; long long arr = 0; for(int i = 0;i<=9;i++) { //arr += (pow(10,i)*9); arr = arr*10+9; sum+=arr; } cout<<sum; return 0; }