您的位置:首页 > 其它

UVA - 458 - The Decoder

2014-04-06 21:02 399 查看
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=399

字符解密。

题目已经说了,字符打印时候,出现ASCII码偏移,都查了单词,我还一开始就拿题目数据做字符码。。。真水。。。

ASCII码直接偏移7解决。

#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

const int MAXN = 1000;

int main()
{
char str[MAXN];
memset(str, 0, sizeof(str));
while ( cin >>str )
{
for ( int i=0; i<strlen(str); i++ )
{
str[i] -= 7;
} // end for
cout <<str <<endl;
} // end while

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: