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

哪里错了啊……大虾帮忙啊……给组数据测试也好啊……THX

Posted by cpp050300448135 at 2005-05-10 12:04:38 on Problem 2159
#include<iostream>
#include<string>
using namespace std;
void main()
{
	string first, second;
	int a[26]={0}, b[26]={0};
	cin>>first>>second;
	string::const_iterator i1 = first.begin();
	string::const_iterator i2 = second.begin();
	
	int alpha=65;

	for(int i=0; i<26; i++)
	{
			i1=first.begin();
			while(i1 != first.end())
			{
				if(*i1==char(alpha))
				{
					if(i==0) a[25]++;
					else a[i-1]++;
					i1++;
				}
				else i1++;
			}
			alpha++;
	}

	alpha=65;

	for(i=0; i<26; i++)
	{
		i2=second.begin();
			while(i2 != second.end())
			{
				if(*i2==char(alpha))
				{
					b[i]++;
					i2++;
				}
				else i2++;
			}
			alpha++;
	}
	
	for(i=0; i<26; i++)
	{
		if(a[i]!=b[i])
		{
			cout<<"NO"<<endl;
			break;
		}
		if(i==25) cout<<"YES"<<endl;
	}
}

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