diff --git a/cpp/2304/230421-CN.cpp b/cpp/2304/230421-CN.cpp new file mode 100644 index 0000000..45dd1fb --- /dev/null +++ b/cpp/2304/230421-CN.cpp @@ -0,0 +1,12 @@ +/** + * 2413. Smallest Even Multiple + * + * Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n. + */ + +class Solution { +public: + static constexpr int smallestEvenMultiple(int n) { + return n << (n & 1); + } +}; \ No newline at end of file diff --git a/cpp/2304/CMakeLists.txt b/cpp/2304/CMakeLists.txt index 87d3eb6..b3b1cbb 100644 --- a/cpp/2304/CMakeLists.txt +++ b/cpp/2304/CMakeLists.txt @@ -4,4 +4,4 @@ PROJECT(2304) SET(CMAKE_CXX_STANDARD 23) SET(CMAKE_EXPORT_COMPILE_COMMANDS true) -ADD_EXECUTABLE(2304 230419.cpp) +ADD_EXECUTABLE(2304 230421-CN.cpp)