Content

有一个 \(80\) 位的 \(01\) 字符串,由 \(8\) 个长度为 \(10\) 的 \(01\) 字符串组成,每个小字符串分别对应一个数字。现在,给出这个字符串和 \(0\) ~ \(9\) 分别对应的 \(01\) 字符串,请你破解出这个字符串对应的数字。

Solution

这么好的题目为什么不用 \(\texttt{map}\) 呢……

分别将 \(0\) ~ \(9\) 的字符串分别映射到对应的数字,然后看每 \(10\) 位字符串分别对应那些数字,就可以直接用 \(\texttt{map}\) 映射出来了。

Code

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <map>
using namespace std; string s[17];
map<string, int> num; int main() {
for(int i = 0; i <= 10; ++i) {
cin >> s[i];
if(i) num[s[i]] = i - 1;
}
int len = s[0].size();
for(int i = 0; i < len; i += 10) {
string tmp = "";
for(int j = 0; j < 10; ++j)
tmp += s[0][i + j];
printf("%d", num[tmp]);
}
return 0;
}

CF94A Restoring Password 题解的更多相关文章

  1. PAT甲题题解-1035. Password (20)-水

    题意:给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o. 让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序.如果没有用户需要修改,则输出对应的语句,注意单复数 ...

  2. 题解【CodeForces1154A】Restoring Three Numbers

    Description Polycarp has guessed three positive integers \(a\), \(b\) and \(c\). He keeps these numb ...

  3. HDU 2825 Wireless Password(AC自动机 + 状压DP)题解

    题意:m个密码串,问你长度为n的至少含有k个不同密码串的密码有几个 思路:状压一下,在build的时候处理fail的时候要用 | 把所有的后缀都加上. 代码: #include<cmath> ...

  4. CF1154A Restoring Three Numbers 题解

    Content 已知有三个正整数 \(a,b,c\),现在给出 \(a+b,a+c,b+c,a+b+c\)(不保证有序)的值,试求出 \(a,b,c\). 数据范围:\(2\leqslant a+b, ...

  5. Codeforces Round #353 (Div. 2) ABCDE 题解 python

    Problems     # Name     A Infinite Sequence standard input/output 1 s, 256 MB    x3509 B Restoring P ...

  6. Recover lost Confluence password

    confluence重置admin密码 复方法: 1. 运行此sql 找到你的管理员帐户: select u.id, u.user_name, u.active from cwd_user u joi ...

  7. Codeforces Round #288 (Div. 2)D. Tanya and Password 欧拉通路

    D. Tanya and Password Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/508 ...

  8. hdu_2825_Wireless Password(AC自动机+状压DP)

    题目链接:hdu_2825_Wireless Password 题意: 给你m个串,问长度为n至少含k个串的字符串有多少个 题解: 设dp[i][j][k]表示考虑到长度为i,第j个自动机的节点,含有 ...

  9. Password

    Description Rivest是密码学专家.近日他正在研究一种数列E = {E[1],E[2],--,E[n]}, 且E[1] = E[2] = p(p为一个质数),E[i] = E[i-2]* ...

随机推荐

  1. springboot访问静态资源404

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring- ...

  2. electron另一种运行方式

    编写helloword 全局安装软件  npm install -g electron 快速编写html  html:5 完整代码和流程: 1.index.html  <!DOCTYPE htm ...

  3. 详解Threejs中的光源对象

    光源的分类 AmbientLight(环境光),PointLight(点光源),SpotLight(聚光源) 和 DirectionalLight(平行光)是基础光源 HemisphereLight( ...

  4. 【机器学习与R语言】10- 关联规则

    目录 1.理解关联规则 1)基本认识 2)Apriori算法 2.关联规则应用示例 1)收集数据 2)探索和准备数据 3)训练模型 4)评估性能 5)提高模型性能 1.理解关联规则 1)基本认识 购物 ...

  5. R 多图间距调整

    在R中多图画到一起的时候,各图间距通常默认的较远. 如下图: 1 par(mfcol=c(2,1)) 2 plot(1:100) 3 plot(1:100) 调整图片间距这时我们要用到par()函数中 ...

  6. No.1 R语言在生物信息中的应用——序列读取及格式化输出

    目的:读入序列文件(fasta格式),返回一个数据框,内容包括--存储ID.注释行(anno).长度(len).序列内容(content) 一.问题思考: 1. 如何识别注释行和序列内容行 2. 如何 ...

  7. Mac下source tree 下的安装

    安装时出现了以下错误,解决方法 git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=source ...

  8. 【玩具】获取B站视频的音频片段

    事情是这样的,我有个和社畜的社会地位不太相符的小爱好--听音乐剧. 基本上是在B站上点开视频听,不是不想在网易云或者QQ音乐听,只是在这些音乐软件上面,我想听的片段要不就收费,要不版本不是我喜欢的,要 ...

  9. ArrayList总结及部分源码分析

    ArrayList源码阅读笔记 1. ArrayList继承的抽象类和实现的接口 ArrayList类实现的接口 List接口:里面定义了List集合的基本接口,ArrayList进行了实现 Rand ...

  10. A Child's History of England.15

    And indeed it did. For, the great army landing from the great fleet, near Exeter, went forward, layi ...