第二题: int main() {     int n;     cin >> n;     vector<double> pos;     vector<double> neg;     while (n--) {         int label;         double p;         cin >> label >> p;         if (label == 1)             pos.push_back(p);         else             neg.push_back(p);     }     double sum = 0;     for (int i = 0; i < pos.size(); i++) {         for (int j = 0; j < neg.size(); j++) {             if (pos[i] > neg[j])                 sum += 1;             else if (pos[i] == neg[j])                 sum += 0.5;         }     }     cout << fixed << setprecision(2) << sum / (pos.size() * neg.size()) << endl;     system("pause");     return 0; }
点赞 评论

相关推荐

12-05 18:09
已编辑
广东药科大学 后端工程师
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务