| ÍøÕ¾Ê×Ò³ | Òµ½çÐÂÎÅ | С×é | Íþ¿Í | È˲Š| ÏÂÔØƵµÀ | ²©¿Í | ´úÂëÌù | ÔÚÏß±à³Ì | ±à³ÌÂÛ̳
»¶Ó­¼ÓÈëÎÒÃÇ£¬Ò»Í¬Çд輼Êõ
Óû§Ãû£º   
 
ÃÜ¡¡Â룺  
¹²ÓÐ 318 È˹Ø×¢¹ý±¾Ìû
±êÌ⣺ΪʲôһֱÊÇWA£¬Ã»´íѽ£¡
È¡ÏûÖ»¿´Â¥Ö÷ ¼ÓÈëÊÕ²Ø
ÉîÀ¶Ç³À¶qyz
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º13
ר¼Ò·Ö£º0
×¢¡¡²á£º2012-3-6
½áÌûÂÊ£º66.67%
ÊÕ²Ø
ÒѽáÌù¡Ì  ÎÊÌâµãÊý£º20 »Ø¸´´ÎÊý£º1 
ΪʲôһֱÊÇWA£¬Ã»´íѽ£¡
ÿ×éÊäÈëÊý¾ÝÕ¼1ÐÐ,ÿÐÐÊý¾ÝµÄ¿ªÊ¼ÊÇ2¸öÕûÊýn(0<=n<=100)ºÍm(0<=m<=100),·Ö±ð±íʾ¼¯ºÏAºÍ¼¯ºÏBµÄÔªËظöÊý£¬È»ºó½ô¸ú×Ån+m¸öÔªËØ£¬Ç°Ãæn¸öÔªËØÊôÓÚ¼¯ºÏA£¬ÆäÓàµÄÊôÓÚ¼¯ºÏB. ÿ¸öÔªËØΪ²»³¬³öint·¶Î§µÄÕûÊý,ÔªËØÖ®¼äÓÐÒ»¸ö¿Õ¸ñ¸ô¿ª.
Èç¹ûn=0²¢ÇÒm=0±íʾÊäÈëµÄ½áÊø£¬²»×ö´¦Àí¡£

Õë¶Ôÿ×éÊý¾ÝÊä³öÒ»ÐÐÊý¾Ý,±íʾA-BµÄ½á¹û,Èç¹û½á¹ûΪ¿Õ¼¯ºÏ£¬ÔòÊä³ö¡°NULL¡±,·ñÔò´ÓСµ½´óÊä³ö½á¹û,ΪÁ˼ò»¯ÎÊÌ⣬ÿ¸öÔªËغóÃæ¸úÒ»¸ö¿Õ¸ñ.

Sample Input
3 3 1 2 3 1 4 7
3 7 2 5 8 2 3 4 5 6 7 8
0 0
 

Sample Output
2 3
NULL



#include<stdio.h>
#define MAX 100
int a[MAX],b[MAX];
int main(void)
{
    int i,j,k,temp,m,n,s=0;
    while(scanf("%d%d",&m,&n)!=EOF)
    {
        if(n==0&&m==0) break;
    for(i=0;i<m;i++)
        scanf("%d",&a[i]);
    for(j=0;j<n;j++)
        scanf("%d",&b[j]);
    for(i=0;i<m-1;i++)
    {
        k=i;
        for(j=i+1;j<m;j++)
            if(a[i]>a[j]) k=j;
            if(k!=i) {temp=a[k];a[k]=a[i];a[i]=temp;}
    }

    for(i=0;i<m;i++)
        for(j=0;j<n;j++)
            if(a[i]==b[j]) a[i]=0;
    for(i=0;i<m;i++)
    {
        if(a[i]) printf("%d ",a[i]);
        s+=a[i];
    }
    if(s==0) printf("NULL");
    printf("\n");
    s=0;
    }
    return 0;
}
ËÑË÷¸ü¶àÏà¹ØÖ÷ÌâµÄÌû×Ó: ÔªËØ¡¡include¡¡
2013-01-20 09:33
ÉîÀ¶Ç³À¶qyz
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º13
ר¼Ò·Ö£º0
×¢¡¡²á£º2012-3-6
ÊÕ²Ø
µÃ·Ö:0 
»Ø¸´ 2Â¥ czz5242199
#include<stdio.h>
#define MAX 100
int a[MAX],b[MAX],c[MAX];
int main(void)
{
    int i,j,k,temp,m,n,p,f;
    while(scanf("%d%d",&m,&n)!=EOF)
    {
        if(n==0&&m==0) break;
    for(i=0;i<m;i++)
        scanf("%d",&a[i]);
    for(j=0;j<n;j++)
        scanf("%d",&b[j]);
    for(i=0;i<m-1;i++)
    {
        k=i;
        for(j=i+1;j<m;j++)
            if(a[i]>a[j]) k=j;
            if(k!=i) {temp=a[k];a[k]=a[i];a[i]=temp;}
    }
   p=0;
    for(i=0;i<m;i++)
    {
        f=0;
        for(j=0;j<n;j++)
            if(a[i]!=b[j]) f++;
        if(f==n) c[p++]=a[i];
    }
    if(p)
    {
        for(i=0;i<p;i++)
            printf("%d ",c[i]);
    }
    else
        printf("NULL");
    printf("\n");
    }
    return 0;
}


Õâ¸öÄØ£¿Ôõô»¹ÊÇWA£¬£¬£¬

·Ü¶·Ö÷ÐýÂÉ£¬Î´À´ÔÚÎÒÊÖÖУ¡
2013-01-21 10:48
¿ìËٻظ´£ºÎªÊ²Ã´Ò»Ö±ÊÇWA£¬Ã»´íѽ£¡
Êý¾Ý¼ÓÔØÖÐ...
 
¡¡¡¡¡¡



¹ØÓÚÎÒÃÇ | ¹ã¸æºÏ×÷ | ±à³ÌÖйú | Çå³ýCookies | TOP | ÊÖ»ú°æ

±à³ÌÖйú °æȨËùÓУ¬²¢±£ÁôËùÓÐȨÀû¡£
Powered by Discuz, Processed in 0.021908 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved