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

Re:哪位大牛给个可以让我检查出错的数据

Posted by hebeboy at 2008-08-15 09:53:25 on Problem 2159
In Reply To:哪位大牛给个可以让我检查出错的数据 Posted by:hebeboy at 2008-08-15 09:53:15
#include "stdio.h"
#include "string.h"

void main()
{char a[110]="0",b[110]="0";
 int c[27],d[27],i,j,m,n,l,s,k,temp=0,tem=0,x=1,y,h,g;
 for(y=0;y<=25;y++)
 {c[y]=0;
  d[y]=0;
 }	
 scanf("%s",a);
 scanf("%s",b);	
for(i=0;i<=99;i++)
  { if(a[i]=='A')c[0]++;
    else if(a[i]=='B')c[1]++;
    else if(a[i]=='C')c[2]++;
     else if(a[i]=='D')c[3]++;
    else if(a[i]=='E')c[4]++;
     else if(a[i]=='F')c[5]++;
      else if(a[i]=='G')c[6]++;
     else if(a[i]=='H')c[7]++;
     else if(a[i]=='I')c[8]++;
   else if(a[i]=='J')c[9]++;
   else if(a[i]=='K')c[10]++;
   else if(a[i]=='L')c[11]++;
   else if(a[i]=='M')c[12]++;
   else if(a[i]=='N')c[13]++;
   else if(a[i]=='O')c[14]++;
   else if(a[i]=='P')c[15]++;
   else if(a[i]=='Q')c[16]++;
  else if(a[i]=='R')c[17]++;
   else if(a[i]=='S')c[18]++;
   else if(a[i]=='T')c[19]++;
   else if(a[i]=='U')c[20]++;  
   else if(a[i]=='V')c[21]++;
   else if(a[i]=='W')c[22]++;
   else if(a[i]=='X')c[23]++;
   else if(a[i]=='Y')c[24]++;
   else if(a[i]=='Z')c[25]++;        
  }
  for(j=0;j<=99;j++)
  { if(b[j]=='A')d[0]++;
 else if(b[j]=='B')d[1]++;
 else if(b[j]=='C')d[2]++;
 else if(b[j]=='D')d[3]++;
 else if(b[j]=='E')d[4]++;
 else if(b[j]=='F')d[5]++;
   else if(b[j]=='G')d[6]++;
   else if(b[j]=='H')d[7]++;
   else if(b[j]=='I')d[8]++;
   else if(b[j]=='J')d[9]++;
   else if(b[j]=='K')d[10]++;
   else if(b[j]=='L')d[11]++;
   else if(b[j]=='M')d[12]++;
   else if(b[j]=='N')d[13]++;
   else if(b[j]=='O')d[14]++;
   else if(b[j]=='P')d[15]++;
   else if(b[j]=='Q')d[16]++;
   else if(b[j]=='R')d[17]++;
   else if(b[j]=='S')d[18]++;
   else if(b[j]=='T')d[19]++;
    else if(b[j]=='U')d[20]++;  
   else if(b[j]=='V')d[21]++;
   else if(b[j]=='W')d[22]++;
   else if(b[j]=='X')d[23]++;
   else if(b[j]=='Y')d[24]++;
   else if(b[j]=='Z')d[25]++;        
  }
  
  
 
  for(l=1;l<=25;l++)
   for(m=l;m<=26-l;m++)
   { if(c[m]<=c[m-1])
   	 {temp=c[m];
   	 c[m]=c[m-1];
   	 c[m-1]=temp;
   	 }   	    	
   }
 
   for(s=1;s<=25;s++)
    for(k=1;k<=26-s;k++)
   { if(d[k]<=d[k-1])
   	 {tem=d[k];
   	 d[k]=d[k-1];
   	 d[k-1]=tem;
   	 }   	    	
   }
  
  for(n=0;n<=25;n++)
   {if(c[n]!=d[n])x=0;
   }
   if(x==0)printf("NO"); 
    else if(x==1)printf("YES");
    
   
}
  

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