Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
给WA战友们一个提示!!最后输出结果时千万不要有回车啊! 否则就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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator