Submission
Status:
PPPPPPPPPP
Score: 100
User: Namkhing
Problemset: จับคู่เลขมงคล
Language: cpp
Time: 0.002 second
Submitted On: 2025-04-11 15:39:38
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
int x;
cin >> x;
bool ok = false;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i] + a[j] == x) {
cout << a[i] << " " << a[j] << "\n";
ok = true;
}
}
}
if (!ok) cout << "No";
}