aiheshan

有多自律,才能有多自由

导航

UVa 458 - The Decoder

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=399

思路:题目是介绍了一种简单的加密方式,明码加上一个整数k为密码。观察输入输出可知k=-7;

#include<iostream>
#include<string>
#include<cstdio>
using namespace std;

int main()
{
 // freopen("input.txt","r",stdin);
   string s;
   int i;
   while(getline(cin,s))
   {
     for(i=0;i<s.length();i++)
         s[i]=s[i]-7;
     cout<<s<<endl;
   }
   return 0;
}

 

posted on 2016-08-03 17:03  aiheshan  阅读(137)  评论(0编辑  收藏  举报