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 Emember at 2009-03-17 09:08:33 on Problem 2141
最后输出结果时千万不要有回车啊!
否则就WA死了!!
水题啊!!
#pragma  warning(disable:4786)
#include <iostream>
#include <map>
#include <string>
using namespace std;
map<char,char> CToCMap;

void init(string src)
{
	for (int i = 0;i < 26; i++)
	{
		CToCMap['a' + i] = src[i];
		CToCMap['A' + i] = src[i]- 32;
	}
}

void decowding(char *msg)
{
	for (int i = 0;i < strlen(msg); i++)
	{
		if (msg[i] >= 'a' && msg[i] <= 'z' || msg[i] >= 'A' && msg[i] <= 'Z')
		{
			cout << CToCMap[msg[i]];
		}
		else
		{
			cout << msg[i];
		}
	}
}
int main()
{
	//freopen("file.txt","r",stdin);
	string src;
	cin >> src;
	init(src);
	char msg[81];
	memset(msg,'0',81);
	while (gets(msg))
	{
		decowding(msg);
	}
	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