From c2192f52e7926889035fcaef38f85039dfda89b8 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 10 Jul 2023 11:39:30 +0200 Subject: [PATCH] chore(cpp): improve skeleton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add power * add ‹using namespace std› Signed-off-by: Matej Focko --- .common/cpp/skeleton.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index efcfe86..6f4ee9e 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -2,6 +2,17 @@ namespace { +using namespace std; + +long pow(long base, long exp) { + if (exp == 0) + return 1; + long half = pow(base, exp / 2); + if (exp % 2 == 0) + return half * half; + return half * half * base; +} + void solve() { // TODO }