杭电2043 请大神帮我看看哪错了?谢谢了!

#include<iostream>
using namespace std;
int main()
{
 int n,i=0,j,b,c,d,e,k;char a[55];
  cin>>n;
  while(i<n)
  {  
         b=0,c=0,d=0,e=0;
     
  getchar();   gets(a);k=strlen(a);
   for(j=0;a[j]<k;j++)
   {  if(a[j]>='a'&&a[j]<='z')
        b=1;
   else  if(a[j]>='A'&&a[j]<='Z')
           c=1;
                 else if(a[j]>=0&&a[j]<=9)
                d=1;    
     else
   if(a[j]=='~'||a[j]=='!'||a[j]=='@'||a[j]=='#'|| a[j]=='$'|| a[j]=='%'||a[j]=='^')                                                                     
    e=1;}
       if(e+b+c+d>=3&&j>=7&&j<=15)
        cout<<"YES"<<endl;
       else
        cout<<"NO"<<endl;
  i++;
  }
  return 0;
}

posted on 2012-09-20 18:52  @ 小浩  阅读(208)  评论(0编辑  收藏  举报