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

在浙大一直LLT,但在这里却AC了,不明原因.........

Posted by KosonLau at 2006-12-22 01:11:50 on Problem 2681
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
	
	char s1[50],s2[50];
	int j;
	int n;
	cin>>n;
	cin.ignore();
	for(j=1;j<=n;j++)
	{

		gets(s1);
		gets(s2);

		int len1,len2;
		len1=strlen(s1);
		len2=strlen(s2);
		
		int a1[26]={0},a2[26]={0};
		int i;
		for(i=0;i<len1;i++)
			a1[s1[i]-'a']++;
		for(i=0;i<len2;i++)
			a2[s2[i]-'a']++;
		int sum=0;
		for(i=0;i<26;i++)
		{
			sum+=int(abs(a1[i]-a2[i]));
		}
		cout<<"Case #"<<j<<":  "<<sum<<endl;
	}
	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