zoukankan      html  css  js  c++  java
  • 【G ECJTU_ACM 11级队员2012年暑假训练赛(2)】

    G - G
    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

    Description

    Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". The antivirus had no objections and Igor K. run the flash application he had downloaded. Immediately his QIP Infinium said: "invalid login/password".

    Igor K. entered the ISQ from his additional account and looked at the info of his main one. His name and surname changed to "H1N1" and "Infected" correspondingly, and the "Additional Information" field contained a strange-looking binary code 80characters in length, consisting of zeroes and ones. "I've been hacked" — thought Igor K. and run the Internet Exploiter browser to quickly type his favourite search engine's address.

    Soon he learned that it really was a virus that changed ISQ users' passwords. Fortunately, he soon found out that the binary code was actually the encrypted password where each group of 10 characters stood for one decimal digit. Accordingly, the original password consisted of 8 decimal digits.

    Help Igor K. restore his ISQ account by the encrypted password and encryption specification.

    Input

    The input data contains 11 lines. The first line represents the binary code 80 characters in length. That is the code written in Igor K.'s ISQ account's info. Next 10 lines contain pairwise distinct binary codes 10 characters in length, corresponding to numbers 0, 1, ..., 9.

    Output

    Print one line containing 8 characters — The password to Igor K.'s ISQ account. It is guaranteed that the solution exists.

    Sample Input

    Input
    01001100100101100000010110001001011001000101100110010110100001011010100101101100
    0100110000
    0100110010
    0101100000
    0101100010
    0101100100
    0101100110
    0101101000
    0101101010
    0101101100
    0101101110
    Output
    12345678
    Input
    00001000011100010110010011111101111010100111101010111000101001001111111110001010
    1100011011
    1100010110
    0011101111
    0100111111
    0001010100
    1110001010
    0111101010
    0000100001
    1110011011
    0010011010
    Output
    71366535


     1 // Project name : G
     2 // File name    : main.cpp
     3 // Author       : Izumu
     4 // Date & Time  : Tue Jul 10 14:15:29 2012
     5 
     6 
     7 #include <iostream>
     8 #include <stdio.h>
     9 #include <string>
    10 #include <cmath>
    11 using namespace std;
    12 
    13 int main()
    14 {
    15     string s;
    16     while (cin >> s)
    17     {
    18         string num[10];
    19         for (int i = 0; i < 10; i++)
    20         {
    21             cin >> num[i];
    22         }
    23 
    24         char str_tmp[20];
    25         for (int time = 0; time < 8; time++)
    26         {
    27             // init for str_tmp
    28             for (int i = 0; i < 20; i++)
    29             {
    30                 str_tmp[i] = '\0';
    31             }
    32 
    33             for (int i = 0; i < 10; i++)
    34             {
    35                 str_tmp[i] = s[time * 10 + i];
    36             }
    37 
    38             string s_tmp = str_tmp;
    39 
    40             bool found = false;
    41             for (int i = 0; !found && i < 10; i++)
    42             {
    43                 if (s_tmp == num[i])
    44                 {
    45                     cout << i;
    46                     found = true;
    47                 }
    48             }
    49         }
    50         cout << endl;
    51     }
    52     return 0;
    53 }
    54 
    55 // end 
    56 // ism 
  • 相关阅读:
    在mac下使用ppk文件ssh到远程主机
    Openstack镜像和密码
    ubuntu下如何用命令行运行deb安装包
    python中使用@property
    linux里的vi怎么移动到最后一行
    Git 怎样保证fork出来的project和原project(上游项目)同步更新
    使用msgfmt编译多语言文件
    ubuntu创建文件夹快捷方式命令
    ssh: connect to host localhost port 22: Connection refused 问题
    excel中如何批量将所有的网址设为超链接
  • 原文地址:https://www.cnblogs.com/ismdeep/p/2584782.html
Copyright © 2011-2022 走看看