From 532cfe7ab268006eeba8b508222821b04a7ca747 Mon Sep 17 00:00:00 2001 From: Lam Haoyin Date: Mon, 31 Jan 2022 13:54:24 +0800 Subject: [PATCH] add: 220131 --- 2201/220131.cpp | 19 +++++++++++++++++++ 2201/CMakeLists.txt | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 2201/220131.cpp diff --git a/2201/220131.cpp b/2201/220131.cpp new file mode 100644 index 0000000..fb9b6e6 --- /dev/null +++ b/2201/220131.cpp @@ -0,0 +1,19 @@ +#include +#include + +class Solution { +public: + static int maximumWealth(const std::vector>& accounts) { + int ret = 0; + for (const auto& i : accounts) { + int t = 0; + std::for_each(i.begin(), i.end(), [&t](const int& v) { t += v; }); + ret = std::max(t, ret); + } + return ret; + } +}; + +int main() { + std::printf("%d\n", Solution::maximumWealth({{1,2,3},{3,2,1}})); +} diff --git a/2201/CMakeLists.txt b/2201/CMakeLists.txt index 05a02eb..768abbd 100644 --- a/2201/CMakeLists.txt +++ b/2201/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(2201) SET(CMAKE_CXX_STANDARD 23) -ADD_EXECUTABLE(2201 220131-CN.cpp) +ADD_EXECUTABLE(2201 220131.cpp)