add: 230421-CN

This commit is contained in:
Eatswap 2023-04-21 17:46:00 +08:00
parent 06b1e482b1
commit 9b372dc10f
Signed by: Eatswap
GPG Key ID: BE661106A1F3FA0B
2 changed files with 13 additions and 1 deletions

12
cpp/2304/230421-CN.cpp Normal file
View File

@ -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);
}
};

View File

@ -4,4 +4,4 @@ PROJECT(2304)
SET(CMAKE_CXX_STANDARD 23) SET(CMAKE_CXX_STANDARD 23)
SET(CMAKE_EXPORT_COMPILE_COMMANDS true) SET(CMAKE_EXPORT_COMPILE_COMMANDS true)
ADD_EXECUTABLE(2304 230419.cpp) ADD_EXECUTABLE(2304 230421-CN.cpp)