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"); } }