From c8ab9bc2611a0d4d915c1a05d73c60d1ede8091e Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 5 Apr 2022 20:18:13 +0800 Subject: [PATCH] =?UTF-8?q?279.=20=E8=87=AA=E7=84=B6=E6=95=B0=E6=8B=86?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/13028632/ --- AcWing/279/279.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 AcWing/279/279.cpp diff --git a/AcWing/279/279.cpp b/AcWing/279/279.cpp new file mode 100644 index 00000000..95141cc8 --- /dev/null +++ b/AcWing/279/279.cpp @@ -0,0 +1,28 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 4005; +const long long mod = 2147483648; + +int n; +long long f[N]; + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n; + + f[0] = 1; + for (int i = 1; i <= n; i++) { + for (int j = i; j <= n; j++) { + f[j] = (f[j] + f[j - i]) % mod; + } + } + + cout << f[n] - 1 << endl; + + return 0; +}