From 45d2400356a0c1c3325fefc70023b5f0f67c2645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E6=99=BA=E7=84=B1?= <13555864+long-zhiya@user.noreply.gitee.com> Date: Fri, 13 Oct 2023 08:49:35 +0000 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E7=AB=A0-=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=A5=87=E6=95=B0=E9=95=BF=E5=BA=A6=E7=9A=84=E5=AD=90=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E5=92=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 龙智焱 <13555864+long-zhiya@user.noreply.gitee.com> --- .../LeetCode1588" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "2209020332/\347\254\254\344\270\200\347\253\240\344\275\234\344\270\232/LeetCode1588" diff --git "a/2209020332/\347\254\254\344\270\200\347\253\240\344\275\234\344\270\232/LeetCode1588" "b/2209020332/\347\254\254\344\270\200\347\253\240\344\275\234\344\270\232/LeetCode1588" new file mode 100644 index 00000000..bb6b5875 --- /dev/null +++ "b/2209020332/\347\254\254\344\270\200\347\253\240\344\275\234\344\270\232/LeetCode1588" @@ -0,0 +1,17 @@ +lass Solution { +public: + int sumOddLengthSubarrays(vector& arr) { + int n = arr.size(); + int sum = 0; + for(int i = 0;i < n;++i) + { + for(int j = 1;j + i <= n;j += 2) + { + int z = i + j - 1; + for(i = 1; i <= z ; i++) + sum += arr[i]; + } + } + return sum; + } +}; \ No newline at end of file -- Gitee