题解 | #求1+2+3+...+n#
求1+2+3+...+n
https://www.nowcoder.com/practice/7a0da8fc483247ff8800059e12d7caf1
#include <algorithm> class Sum{ public: Sum() { _ret+=_i; _i++; } static int Getret() { return _ret; } private: static int _i; static int _ret; }; int Sum:: _i=1; int Sum:: _ret=0; class Solution { public: int Sum_Solution(int n) { Sum a[n]; return Sum::Getret(); } };