Submission

Status:

PPP--PPP--

Subtask/Task Score:

60/100

Score: 60

User: ssens3

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-04 13:06:49

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n, ln; cin >> n; vector<int> v(n); bool o = true;
    for (int i = 0; i < n; i++) cin >> v[i];
    cin >> ln;
    for (int i = 0; i < n; i++){
        for (int j  = i+1; j < n-1; j++){
            if (v[i] + v[j] == ln){
                cout << v[i] << " " << v[j] << "\n"; o = false;
                v[i] = 0; v[j] = 0;
            }
        }
    }
    if (o) cout << "No";
}