Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Gundhon

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-12 20:38:44

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int x,y;
    cin >> x;
    int arr[x];
    vector<int> a;
    vector<int> b;

    for(int i = 0; i < x; i++){
        cin >> arr[i];
    }

    cin >> y;

    for(int i = 0; i < x-1; i++){
        for(int j = i+1; j < x; j++){
            if(arr[i]+arr[j] == y){
                a.push_back(arr[i]);
                b.push_back(arr[j]);
            }
        }
    }

    if(a.empty()) cout << "No";

    else{
        for(int i = 0; i < a.size(); i++){
            cout << a[i] << " " << b[i] << endl;
        }
    }

    return 0;
}