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:有没有好的测试数据,我本机测试都好的,提交却WA

Posted by Refyl at 2007-05-13 16:57:11 on Problem 2159
In Reply To:有没有好的测试数据,我本机测试都好的,提交却WA Posted by:Refyl at 2007-05-13 16:35:51
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int cmp( const void *a , const void *b ) 
{ 
    return *(char *)a - *(char*)b; 
}
int main(){
	int i,len,j,flag;
	char c[100],cr[100],m[100];
	scanf("%s",c);
	scanf("%s",m);
	for(i=0;c[i];i++);
	len=i;
	qsort(c,len,sizeof(char),cmp);
	qsort(m,len,sizeof(char),cmp);
	for(i=0;i<26;i++){
		for(j=0;j<len;j++){
			cr[j]=c[j]+i;
			if(cr[j]>'Z')cr[j]-=26;
		}
		qsort(cr,len,sizeof(char),cmp);
		if(strcmp(cr,m)==0){
			printf("YES");
			return 0;
		}
	}
	printf("NO");
	return 1;
}

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