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 tangyanhan at 2009-09-05 20:02:09 on Problem 2159
好不容易写了个简洁的程序,提供的那个测试数据也能通过,为什么却总是WA?
#include<stdio.h>
#include<stdlib.h>
main()
{
	char txt[100]={'\0'};
	char cipher[100]={'\0'};
	int i;
	int t[26]={0},
	c[26]={0};
	int flag=1;
 	scanf("%s",&cipher);
	scanf("%s",&txt);
	for(i=0;txt[i]!='\0';++i)
	{
		if(txt[i]=='Z')
			txt[i]='A';
		else txt[i]++;
	}
	for(i=0;txt[i]!='\0';++i)
	{
		t[txt[i]-65]++;
		c[cipher[i]-65]++;
	}
	for(i=0;i<26;i++)
	{	
		if(t[i]!=c[i])
		{
			printf("NO");
			return 0;
		}
	}
	printf("YES");
	return 0;
}

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