Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Kei
Problemset: จับคู่เลขมงคล
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-08 14:58:19
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
void solve(){
int n,k; cin >> n;
int cur,match;
vector<int> v(n);
vector<pii> chosen;
for(int& x : v) cin >> x;
cin >> k;
for(int i=0;i<n;i++){
cur=v[i];
match = k-cur;
for(int j=i+1;j<n;j++){
if(v[j]==match){
chosen.push_back({cur,match});
}
}
}
for(pii& p : chosen) cout << p.first << ' ' << p.second << '\n';
if(chosen.empty()) cout << "No";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}