From aa49d1b3bd311f971cb8452c9abc25c9990ff4e2 Mon Sep 17 00:00:00 2001 From: leo12025 Date: Mon, 4 Aug 2025 17:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8E=E6=8C=87=E5=AE=9A=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=9A=84=E6=95=B0=E7=9A=84=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test01/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test01/main.cpp b/test01/main.cpp index 6a18cbe..c1c3711 100644 --- a/test01/main.cpp +++ b/test01/main.cpp @@ -1,15 +1,19 @@ #include "iostream" using namespace std; -int a[105], n, k; +int a[105], n, m, c = 0; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } - for (int i = n; i >= 1; i--) { - cout << a[i]; + cin >> m; + for (int i = 1; i <= n; i++) { + if (a[i] == m) { + c++; + } } + cout << c << endl; return 0; }