题目:P5728旗鼓相当的对手
using namespace std;
int cnt=0;
bool s=false,t=false;
struct peo{
int num;
int chi;
int mat;
int eng;
int tot;
};
struct peo peo[4];
void single(int a,int b) {
if((peo[a].chi-peo[b].chi)>=0 ||(peo[a].chi-peo[b].chi)<=5) {
if((peo[a].mat-peo[b].mat)>=0 ||(peo[a].mat-peo[b].mat)<=5) {
if((peo[a].eng-peo[b].eng)>=0 ||(peo[a].eng-peo[b].eng)<=5) {
s=true;
}
}
}
}
void total(int c,int d) {
if((peo[c].tot-peo[d].tot)>=0 ||(peo[c].tot-peo[d].tot)<=5) {
t=true;
}
}
int main() {
int t;
cin>>t;
for(int i=1;i<=t;i++) {
cin>>peo[i].num>>peo[i].chi>>peo[i].mat>>peo[i].eng;
peo[i].tot=peo[i].chi+peo[i].mat+peo[i].eng;
}
for(int i=1;i<=t;i++) {
for(int j=1;j<=t;i++) {
single(i,j);
total(i,j);
if(s==true || t==true) {
cnt++;
}
}
}
cout<<cnt;
}