• + 0 comments
    void plusMinus(vector<int> arr) {
        int cnt[3] = {0,0,0};
        float s = 1.0f/arr.size();
        for (auto x : arr)
            cnt[(x > 0) - (x < 0) + 1]++;
    
        cout << fixed;
        cout << s * cnt[2] << endl;
        cout << s * cnt[0] << endl;
        cout << s * cnt[1] << endl;
    }