From c62ff39d9025efd03ea4e6bda76f307caffc1089 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Mon, 2 Aug 2021 18:54:51 +0800 Subject: [PATCH] =?UTF-8?q?727.=20=E8=8F=B1=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/6846123/ --- AcWing/727/727.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 AcWing/727/727.cpp diff --git a/AcWing/727/727.cpp b/AcWing/727/727.cpp new file mode 100644 index 00000000..11c9b236 --- /dev/null +++ b/AcWing/727/727.cpp @@ -0,0 +1,27 @@ +#include + +using namespace std; + +int main() { + int n; + cin >> n; + for (int i = 1; i <= n / 2 + 1; i++) { + for (int j = 1; j <= n / 2 + 1 - i; j++) { + cout << ' '; + } + for (int j = 1; j <= 2 * i - 1; j++) { + cout << '*'; + } + cout << endl; + } + for (int i = 1; i <= n / 2; i++) { + for (int j = 1; j <= i; j++) { + cout << ' '; + } + for (int j = 1; j <= 2 * ((n / 2 + 1) - i) - 1; j++) { + cout << '*'; + } + cout << endl; + } + return 0; +}