1 条题解

  • 0
    @ 2025-12-5 12:25:26

    C++ :

    #include <iostream>
    #include <cmath>
    
    using namespace std;
    int main(){
        int ch[1001], ma[1001], en[1001], n;
        cin >> n;
        for(int i = 0; i < n; ++i){
            cin >> ch[i] >> ma[i] >> en[i];
        }
    
        int cnt = 0;
        for(int i = 0; i < n; ++i){
            int c1 = ch[i];
            int m1 = ma[i];
            int e1 = en[i];
            int t1 = c1 + m1 + e1;
            for(int j = i + 1; j < n; ++j){
                int c2 = ch[j];
                int m2 = ma[j];
                int e2 = en[j];
                int t2 = c2 + m2 + e2;
                if(abs(c1 - c2) <= 5 && abs(m1 - m2) <= 5 && abs(e1 - e2) <= 5 && abs(t1 - t2) <= 10){
                    cnt++;
                }
            }
        }
    
        cout << cnt << endl;
        return 0;
    }
    
    
    • 1

    信息

    ID
    68
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者