Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Nuttykub

Problemset: จับคู่เลขมงคล

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-02 14:58:53

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int> vec(n);
    for (auto &x : vec) cin >> x;

    int lucky;
    cin >> lucky;

    bool found = false;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (vec[i] + vec[j] == lucky) {
                cout << vec[i] << " " << vec[j] << "\n";
                found = true;
            }
        }
    }
    if (!found) cout << "No\n";
}