mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-18 09:11:59 +00:00
9 lines
132 B
C++
9 lines
132 B
C++
|
class Solution {
|
||
|
public:
|
||
|
int getSum(int n) {
|
||
|
int r = n;
|
||
|
n && (r += getSum(n - 1));
|
||
|
return r;
|
||
|
}
|
||
|
};
|