求大佬解答
查看原帖
求大佬解答
364331
比企谷··八幡楼主2020/7/31 20:47
#include <iostream>;
using namespace std;

int main()
{
    int chi[1002], mat[1002], eng[1002], tot[1002];
    int n,answer=0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> chi[i] >> mat[i] >> eng[i];
        tot[i] = chi[i] + mat[i] + eng[i];
    }
    for (int i = 0; i < n; i++)
        for(int j=i+1;j<n;j++)
        {
            if ((abs(chi[i] - chi[j]) <= 5)&&(abs(mat[i] - mat[j])) <= 5 && (abs(eng[i] - eng[j]) )<= 5 && (abs(tot[i] - tot[j])) <= 10);
            answer++;
        }
    cout << answer;

    return 0;
}

2020/7/31 20:47
加载中...