From f5a875fab4847e3addf8fc52b375d3ea6308f40e Mon Sep 17 00:00:00 2001 From: Baoshuo Ren Date: Tue, 8 Feb 2022 10:52:04 +0800 Subject: [PATCH] =?UTF-8?q?800.=20=E6=95=B0=E7=BB=84=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E7=9A=84=E7=9B=AE=E6=A0=87=E5=92=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/10689264/ --- AcWing/800/800.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 AcWing/800/800.cpp diff --git a/AcWing/800/800.cpp b/AcWing/800/800.cpp new file mode 100644 index 00000000..767afcb5 --- /dev/null +++ b/AcWing/800/800.cpp @@ -0,0 +1,27 @@ +#include + +using std::cin; +using std::cout; +#define endl '\n' + +const int N = 100005; + +int n, m, x, a[N], b[N]; + +int main() { + cin >> n >> m >> x; + for (int i = 0; i < n; i++) { + cin >> a[i]; + } + for (int i = 0; i < m; i++) { + cin >> b[i]; + } + for (int i = 0, j = m - 1; i < n; i++) { + while (a[i] + b[j] > x) j--; + if (a[i] + b[j] == x) { + cout << i << ' ' << j << endl; + exit(0); + } + } + return 0; +}