From af3743ba87c1fc85c84c8c9d2056604a140ea43d Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 9 May 2022 19:29:06 +0800 Subject: [PATCH] =?UTF-8?q?84.=20=E6=B1=821+2+=E2=80=A6+n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/14064231/ --- AcWing/84/84.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 AcWing/84/84.cpp diff --git a/AcWing/84/84.cpp b/AcWing/84/84.cpp new file mode 100644 index 00000000..5bdfa075 --- /dev/null +++ b/AcWing/84/84.cpp @@ -0,0 +1,8 @@ +class Solution { + public: + int getSum(int n) { + int r = n; + n && (r += getSum(n - 1)); + return r; + } +};