错哪啦!!??
查看原帖
错哪啦!!??
1389759
yanglichen2012楼主2025/7/19 22:59

到底错哪了,求教! TOT

#include <iostream>
using namespace std;
struct nm{
    int y;
    int s;
    int e;
}a[1001];
int mian(){
    int z[1001];
    int x;
    int sum = 0;
    cin>>x;
    for(int f = 0; f<x; f++){
        cin>>a[f].y>>a[f].s>>a[f].e;
        z[f] = a[f].y+a[f].s+a[f].e;
    }
    int c,n,m;
    for(int f = 0; f<x; f++){
        for(int e = f+1; e<x; e++){
            c = a[f].y-a[e].y;
            n = a[f].s-a[e].s;
            m = a[f].e-a[e].e;
            if(c<=5&&c>=-5&&n<=5&&n>=-5&&m<=5&&m>=-5){
                if(z[f]-z[e]<=10&&z[f]-z[e]>=-10){
                    sum++;
                }
            }
        }
    }
    cout<<sum;
    return 0;
}
2025/7/19 22:59
加载中...