problemcutter

导航

SPOJ Problem 2178:He is offside!

http://www.spoj.com/problems/OFFSIDE/

阅读题。。

#include<cstdio>
#include<cstring>
int x,a,b,c,n,m,i;
int main(){
    while(scanf("%d%d",&n,&m)&&(n+m)){
        a=b=c=100000;
        for (i=1;i<=n;i++){
            scanf("%d",&x);
            if (x<a)a=x;
        }
        for (i=1;i<=m;i++){
            scanf("%d",&x);
            if (x<b){c=b;b=x;}else
            if (x<c)c=x;
        }
        if (c>a)printf("Y\n");else
        printf("N\n");
    }
}

 

posted on 2015-03-08 15:33  problemcutter  阅读(163)  评论(0编辑  收藏  举报