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