Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

牛人帮忙看看 为什么总是wa

Posted by SuperYanyan at 2010-02-25 21:22:56
#include<stdio.h>
#include<string.h>
void main()
{
 int m,n,i=0,j,h,length1,length2,flag=0;
 char a[100],b[100],c[100];
 gets(a);
 gets(b);
 length1=strlen(a);
 length2=strlen(b);
 for(i=0;i<27;i++)
 {
 for(m=0;m<length2;m++)
 { 
  for(n=0;n<length1;n++)
  {
   c[n]=a[n]-i;
   c[length1]='\0';
  
   if(b[m]==c[n]) 
    flag++;
  }
 }
 for(m=0;m<length1;m++)
 {
  for(n=m+1;n<=length1;n++)
  {
   if(b[m]==b[n]) flag=flag-2;
  }
 }
 if(flag==length1&&i<=24) {
 printf("YES\n");break;}
  if (i==26&&flag<length1) {
 printf("NO\n");break;}
 }

 
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator