Varianta 23 / Subiectul 3 / Problema 4 |
#include<fstream> #include<iostream> using namespace std; int main() { int n, a[1000], b[1000],i,j,k; ifstream fin("bac.txt"); fin>>n; for(i=1;i<=n;i++) fin>>a[i]>>b[i]; for(i=1;i<=n;i++) { k=0; for(j=1;j<=n;j++) if(i!=j) if(a[i]>b[j] || a[j]>b[i]) k++; if(k==n-1) cout<<a[i]<<" "<<b[i]<<endl; } fin.close(); system("pause"); return 0; } |