Codeforces 94A-Restoring Password

本文介绍了一个有趣的编程问题,即如何帮助角色IgorK.通过已加密的二进制代码及一组对应的十进制数字来恢复他的即时通讯软件ISQ账户密码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Restoring Password
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 80 characters 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.

Examples
input
01001100100101100000010110001001011001000101100110010110100001011010100101101100
0100110000
0100110010
0101100000
0101100010
0101100100
0101100110
0101101000
0101101010
0101101100
0101101110
output
12345678
input
10101101111001000010100100011010101101110010110111011000100011011110010110001000
1001000010
1101111001
1001000110
1010110111
0010110111
1101001101
1011000001
1110010101
1011011000
0110001000
output
30234919
题意:先给出一串长度为80的加密密码,在给出10串长度为10个的不同的二进制代码,对应于数字0,1,...,9,原始密码由8个十进制数字组成,通过加密的密码和10个二进制代码找到原始密码

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>

using namespace std;

#define ll long long
map<string,int>x;

string ch,s,s1;

int main()
{
    while(cin>>ch)
    {
        int len=ch.length();
        for(int i=0;i<10;i++)
        {
            cin>>s;
            x[s]=i;
        }
        for(int i=0;i<len;i+=10)
        {
            s1=ch.substr(i,10);
            printf("%d",x[s1]);
        }
        printf("\n");
    }
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值