Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: cyblox_boi
Problemset: จับคู่เลขมงคล
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-22 20:28:12
#include <iostream>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> birthdays(n);
for (int i = 0; i < n; i++) {
cin >> birthdays[i];
}
int luckyNumber;
cin >> luckyNumber;
bool hasFound = false;
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (birthdays[i] + birthdays[j] == luckyNumber) {
hasFound = true;
cout << birthdays[i] << ' ' << birthdays[j] << '\n';
}
}
}
if (!hasFound) {
cout << "No" << '\n';
}
return 0;
}