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 270987650 at 2007-08-31 23:42:14 on Problem 2141
#include "iostream"
#include "string"
using namespace std;
int main()
{
	char str1[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
		            'p','q','r','s','t','u','v','w','x','y','z'};
	char str2[26];
    char str4[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
		            'P','Q','R','S','T','U','V','W','X','Y','Z'};
    char str3[81];
	for(int m=0;m<26;m++)
     cin>>str2[m];
	cin.ignore(1024,'\n');
	getline(cin,str3);
	int n;
    n=str3.length();
    for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			for(int q=0;q<26;q++)
			{
				if(str3[0]==str4[q])
				{
					for(int r=0;r<26;r++)
					{
                        if(str2[q]==str1[r])
							str3[0]=str4[r];
                    }     
					break;
				}
			}
		}
		else
		{
			for(int j=0;j<26;j++)
			{
				if(str3[i]==str1[j])
				{
					str3[i]=str2[j];
					break;
				}
			}
		}
	}
	for(i=0;i<n;i++)
		cout<<str3[i];
	cout<<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