Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Bestzu

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-14 10:51:53

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

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

	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int target; cin >> target;
	bool found = false;
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			if(a[i] + a[j] == target) {
				cout << a[i] << " " << a[j] << endl;
				found = true;
			}
		}
	}
	if(!found) cout << "No";
    return 0;
}