陈朋飞


私信TA

用户名:fgzsfgzs

访问量:7692

签 名:

等  级
排  名 160
经  验 6885
参赛次数 0
文章发表 73
年  龄 21
在职情况 学生
学  校 南昌工程学院
专  业 通信 兼修 计算机

  自我简介:

欢迎加我QQ进行交流:2148491591,本人 C语言,C++,JAVA都会一点

解题思路:

注意事项:

参考代码:

#include <iostream>

#include<cstdio>

#include<cstring>

#include<set>

#include<string>

#include<vector>

#include<algorithm>

using namespace std;

bool paixu(int s1, int s2)

{

    return s1 < s2;

}

int main()

{

    int n;

    int a[1000], b[1000];

    a[0] = 0;

    b[0] = 0;

    while (cin >> n)

    {

        if (n == 0)

            break;

        for (int i = 1; i <= n; i++)

            cin >> a[i];

        for (int j = 1; j <= n; j++)

            cin >> b[j];

        sort(a,a+n,paixu);

        sort(b,b+n,paixu);

        int sum = 0;

        for (int i = 1,j=1; i <= n; i++)

        {

            if (a[i] > b[j])

            {

                sum++;

                j++;

            }


        }

        if (sum > n / 2)

            cout << "YES" << endl;

        else

            cout << "NO" << endl;

    }

    return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区