UVA 458:The Decoder

Jasonlin posted @ 2011年3月27日 11:17 in UVA , 2347 阅读

题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=399

题目大意:

      这道题是最最基础的密码学知识,就是明文的每个字母加上一个数变成密文,现在给我们密文,转化为原文。

解题思路:

      找到密钥然后每个字母减去密钥。

解题代码:

#include<iostream>
#include<string>
using namespace std;
int main(){
	int t='1'-'*';
	string s;
	while(getline(cin,s)){
		int len=s.length();
		for(int i=0;i<len;i++)
			s[i]-=t;
		cout<<s<<endl;
	}
	return 0;
}

扩展知识:http://baike.baidu.com/view/25311.htm

  • 无匹配
  • 无匹配

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter