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 C061200548322 at 2006-05-21 17:10:46 on Problem 2159
#include<iostream>
#include<string>

using namespace std;

int  main()
{
	int i,len1;
	string s1,fromS1,code="BCDEFGHIJKLMNOPQRSTUVWXYZA";

	bool stop = false;
	cin>>fromS1>>s1;
	
	len1 = s1.length();
	string mid(len1, ' '); //必须声明并定义时才可以用(len1, ' ')
	
	for( i=0; i<len1; i++ ){		
		mid.at(i) = code.at( s1.at(i) - 'A' );
		if( fromS1.find(mid[i]) == string::npos ) {
			stop=true;
			break;
		}
	}

	if( stop ) cout<<"NO\n";
	else cout<<"YES\n";
	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