1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include<iostream> #include<string> #include<cmath> using namespace std; struct node { string name;int ch;int ma;int en;int sum; }g[1001]; int main() { int n;cin>>n; for(int i=1;i<=n;i++) { cin>>g[i].name>>g[i].ch>>g[i].ma>>g[i].en; g[i].sum=g[i].ch+g[i].ma+g[i].en; } for(int i=1;i<n;i++) { for(int j=i+1;j<=n;j++) { if(abs(g[i].ch-g[j].ch)<=5&&abs(g[i].ma-g[j].ma)<=5&&abs(g[i].en-g[j].en)<=5&&abs(g[i].sum-g[j].sum)<=10) cout<<g[i].name<<" "<<g[j].name<<endl; }
} return 0; }
|