9 条题解

  • 1
    @ 2022-07-29 15:04:54

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
    int n1,n2,l=0,tep=0;
    cin>>n1>>n2;
    int a[n1],b[n2],c[n1+n2];
    for(int i=0;i<n1;i++)
    {
    cin>>a[i];
    }
    for(int i=0;i<n2;i++)
    {
    cin>>b[i];
    }
    for(int i=0;i<n1;i++)
    {
    b[n2+i]=a[i];
    }
    for(int i=0;i<n1+n2;i++)
    {
    for(int j=i+1;j<n1+n2;j++)
    {
    if(b[i]==b[j])
    {
    b[j]=0;
    }

    }
    }

    for(int i=0;i<n1+n2;i++)
    {
    if(b[i]!=0)
    {
    tep++;
    }
    }
    cout<<tep;
    return 0;
    }

  • 1

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    int n1;
    int n2;
    int *N;
    int count = 0;
    int temp;
    int flag = 0;

    scanf("%d", &n1);
    scanf("%d", &n2);
    if (n1 >= 10000 || n2 >= 10000)
    {
    return -1;
    }
    N = (int )malloc(sizeof(int)(n1+n2));

    for (int i = 0; i < n1; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (*(N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    (N + i) = temp;
    count++;
    }
    }
    for (int i = n1; i < n1 + n2; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (
    (N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    *(N + i) = temp;
    count++;
    }
    }
    printf("%d", count);
    }

  • 0
    @ 2023-08-28 12:34:48

    #include <stdio.h>

    int main()
    {
    int n1,n2;
    scanf("%d %d",&n1,&n2);
    int n=n1+n2;
    int a[n];
    for(int i=0;i<n1;i++)
    {scanf("%d",&a[i]);}
    for(int i=n1;i<n2;i++)
    {scanf("%d",&a[i]);}//拼接两次比赛名单
    for(int i=0;i<n;i++)
    {for(int j=n-1;j>i;j--)
    {if(a[j]==a[i]){a[j]=0;}
    }}//去除相同项
    int total=0;
    for(int i=0;i<n;i++)
    {if(a[i]!=0){total++;}}
    printf("%d",total);
    return 0;
    }
    所以自测都能过评测为毛 AC0 WA5(毕加思索)

  • 0
    @ 2021-03-20 20:32:00

    setsetsetsetset最短

    #include<iostream>
    #include<set>
    using namespace std;
    int main()
    {
        set<int> a;
        int na,nb,j,j1;cin>>na>>nb;
        for(int i=0;i<na;i++)
        {
            cin>>j;
            a.insert(j);
        }
        for(int i=0;i<nb;i++)
        {
            cin>>j1;
            a.insert(j1);
        }
        cout<<a.size();
        return 0;
    }
    
    
  • 0

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    int n1;
    int n2;
    int *N;
    int count = 0;
    int temp;
    int flag = 0;

    scanf("%d", &n1);
    scanf("%d", &n2);
    if (n1 >= 10000 || n2 >= 10000)
    {
    return -1;
    }
    N = (int )malloc(sizeof(int)(n1+n2));

    for (int i = 0; i < n1; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (*(N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    (N + i) = temp;
    count++;
    }
    }
    for (int i = n1; i < n1 + n2; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (
    (N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    *(N + i) = temp;
    count++;
    }
    }
    printf("%d", count);
    }

  • 0

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    int n1;
    int n2;
    int *N;
    int count = 0;
    int temp;
    int flag = 0;

    scanf("%d", &n1);
    scanf("%d", &n2);
    if (n1 >= 10000 || n2 >= 10000)
    {
    return -1;
    }
    N = (int )malloc(sizeof(int)(n1+n2));

    for (int i = 0; i < n1; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (*(N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    (N + i) = temp;
    count++;
    }
    }
    for (int i = n1; i < n1 + n2; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (
    (N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    *(N + i) = temp;
    count++;
    }
    }
    printf("%d", count);
    }

  • -2

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    int n1;
    int n2;
    int *N;
    int count = 0;
    int temp;
    int flag = 0;

    scanf("%d", &n1);
    scanf("%d", &n2);
    if (n1 >= 10000 || n2 >= 10000)
    {
    return -1;
    }
    N = (int )malloc(sizeof(int)(n1+n2));

    for (int i = 0; i < n1; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (*(N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    (N + i) = temp;
    count++;
    }
    }
    for (int i = n1; i < n1 + n2; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if ((N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    *(N + i) = temp;
    count++;
    }
    }
    printf("%d", count);
    }

  • -2

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    int n1;
    int n2;
    int *N;
    int count = 0;
    int temp;
    int flag = 0;

    scanf("%d", &n1);
    scanf("%d", &n2);
    if (n1 >= 10000 || n2 >= 10000)
    {
    return -1;
    }
    N = (int )malloc(sizeof(int)(n1+n2));

    for (int i = 0; i < n1; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if (*(N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    (N + i) = temp;
    count++;
    }
    }
    for (int i = n1; i < n1 + n2; i++)
    {
    scanf("%d", &temp);
    for (int j = 0; j < i; j++)
    {
    if ((N + j) == temp)
    {
    flag = 1;
    break;
    }
    }
    if (flag == 1)
    {
    flag = 0;
    continue;
    }
    else
    {
    *(N + i) = temp;
    count++;
    }
    }
    printf("%d", count);
    }

  • -2
    @ 2019-04-16 19:21:20
    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
        int n1;
        int n2;
        int *N;
        int count = 0;
        int temp;
        int flag = 0;
    
        scanf("%d", &n1);
        scanf("%d", &n2);
        if (n1 >= 10000 || n2 >= 10000)
        {
            return -1;
        }
        N = (int *)malloc(sizeof(int)*(n1+n2));
        
        for (int i = 0; i < n1; i++)
        {
            scanf("%d", &temp);
            for (int j = 0; j < i; j++)
            {
                if (*(N + j) == temp)
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
            {
                flag = 0;
                continue;
            }
            else
            {
                *(N + i) = temp;
                count++;
            }
        }
        for (int i = n1; i < n1 + n2; i++)
        {
            scanf("%d", &temp);
            for (int j = 0; j < i; j++)
            {
                if (*(N + j) == temp)
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
            {
                flag = 0;
                continue;
            }
            else
            {
                *(N + i) = temp;
                count++;
            }
        }
        printf("%d", count);
    }
    
  • 1

信息

难度
2
分类
(无)
标签
递交数
943
已通过
284
通过率
30%
被复制
10
上传者