• UVA


     The Decoder 

    Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character substitution based upon a single arithmetic manipulation of the printable portion of the ASCII character set.

    Input and Output

    For example: with the input file that contains:

    1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
    1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
    1KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5

    your program should print the message:

    *CDC is the trademark of the Control Data Corporation.
    *IBM is a trademark of the International Business Machine Corporation.
    *DEC is the trademark of the Digital Equipment Corporation.

    Your program should accept all sets of characters that use the same encoding scheme and should print the actual message of each set of characters.

    Sample Input

    1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
    1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
    1KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5

    Sample Output

    *CDC is the trademark of the Control Data Corporation.
    *IBM is a trademark of the International Business Machine Corporation.
    *DEC is the trademark of the Digital Equipment Corporation.
    
    
    
    
    有史以来最水的水题。。。
    #include <bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        string in;
        while(getline(cin, in))
        {
            for(auto &i : in)
                i = i - 7;
            cout << in << endl;
        }
        return 0;
    }


  • 相关阅读:
    23.java方法的深入
    MapReduce:详解Shuffle过程
    Hadoop1.x与Hadoop2的区别
    进程控制的一些api
    程序的静态链接,动态链接和装载
    用户级线程和内核级线程的区别
    从Hadoop框架与MapReduce模式中谈海量数据处理(含淘宝技术架构) (转)
    海量处理面试题
    面试中的二叉树题目
    linux 进程间消息队列通讯
  • 原文地址:https://www.cnblogs.com/kunsoft/p/5312792.html
Copyright © 2020-2023  润新知