题解 | #求1+2+3+...+n#
求1+2+3+...+n
https://www.nowcoder.com/practice/7a0da8fc483247ff8800059e12d7caf1
static int count = 0; class sum { public: sum() { _count += _i; ++_i; } static int Getcount() { return _count; } private: static int _i; static int _count; }; int sum::_i = 1; int sum::_count = 0; class Solution { public: int Sum_Solution(int n) { sum arr[n]; return sum::Getcount(); } };