From 55fc80021b2882c5e6b1473ec2a102ee6a51e785 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Sat, 10 Feb 2024 15:33:50 +0100 Subject: [PATCH] Create example.test.cpp --- examples/example.test.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/example.test.cpp diff --git a/examples/example.test.cpp b/examples/example.test.cpp new file mode 100644 index 0000000..23664cc --- /dev/null +++ b/examples/example.test.cpp @@ -0,0 +1,23 @@ +#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/4/ALDS1_4_B" +#include +#include +#include +#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) +#define ALL(x) std::begin(x), std::end(x) +using namespace std; + +int main() { + int n; cin >> n; + vector s(n); + REP (i, n) { + cin >> s[i]; + } + int q; cin >> q; + int cnt = 0; + while (q --) { + int t_i; cin >> t_i; + cnt += binary_search(ALL(s), t_i); + } + cout << cnt << endl; + return 0; +}