Description

Bacon's cipher or the Baconian cipher is a method of steganography (a method of hiding a secret message as opposed to a true cipher) devised by Francis Bacon. A message is concealed in the presentation of text, rather than its content. 
As we all know, each letter has its position in the alphabet, ‘A’ is 0, ‘B’ is 1, ‘C’ is 2…and so on. And each number can be represented in binary code, for example, 2 is ‘10’ in binary system. Then we expand the binary code to five digits by adding leading zeros, then 10 becomes 00010. Now we can use this number to encode. To simplify the question, we define the rules as below: 
0 corresponds to a random uppercase letter and 1 corresponds to a random number, so after encoding, 00010 ( ‘C’ ) is transformed to ABC1D or JUG9N. 
To decode, do the opposite way around. 
 

Input

The first line contains a positive number l, represents the length of the encoded string. L<=10000 and can be divided by 5. The second line is the encoded string.
 

Output

The original string.
 

Sample Input

35
ON1E2H5Q39AK2TGIC9ERT39B2P423L8B20D
 

Sample Output

FLEENOW
 
题目意思:培根密码的转换机制,在培根密码中,大写字母代表0,数字代表1,然后将得到的二进制数按照5个一组的规律转换成十进制进而转换成大写字母,0代表A,1代表B,以此类推。
 
解题思路:直接模拟一下即可。
 
 
 
 #include<stdio.h>
#include<string.h>
int main()
{
int n,i,ans;
int a[];
char c;
while(scanf("%d",&n)!=EOF)
{
getchar();
for(i=;i<n;i++)
{
scanf("%c",&c);
if(c>='A'&&c<='Z')
{
a[i]=;
}
else
{
a[i]=;
} }
for(i=;i<n;i+=)
{
ans=a[i]*+a[i+]*+a[i+]*+a[i+]*+a[i+]*;
printf("%c",ans+'A');
}
printf("\n");
}
return ;
}

Bacon's Cipher(培根密码)的更多相关文章

  1. HDU4144:Bacon's Cipher

    Problem Description Bacon's cipher or the Baconian cipher is a method of steganography (a method of ...

  2. [CTF]培根密码

    [CTF]培根密码 ---------------------  作者:adversity`  来源:CSDN  原文:https://blog.csdn.net/qq_40836553/articl ...

  3. CTF密码学总结

    CTF中那些脑洞大开的编码和加密 摘自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会遇到 ...

  4. CTF中编码与加解密总结

    CTF中那些脑洞大开的编码和加密 转自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会遇到 ...

  5. [CTF]中那些脑洞大开的编码和加密

    [CTF]中那些脑洞大开的编码和加密 摘自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会 ...

  6. CTF---密码学入门第二题 我喜欢培根

    我喜欢培根分值:20 来源: Ph0enix 难度:中 参与人数:3449人 Get Flag:1410人 答题人数:1653人 解题通过率:85% key: CTF{} 解题链接: http://c ...

  7. CTF中常见密码题解密网站总结

    0x00.综合 网站中包含大多编码的解码. http://web2hack.org/xssee/ https://www.sojson.com/ http://web.chacuo.net/ 0x01 ...

  8. JarvisOJ Basic 爱吃培根的出题人

    听说你也喜欢吃培根?那我们一起来欣赏一段培根的介绍吧: bacoN is one of aMerICa'S sWEethEartS. it's A dARlinG, SuCCulEnt fOoD tH ...

  9. ctf古典密码从0到

    本文首发于“合天智汇”公众号 作者:淡灬看夏丶恋雨 古典密码和现代密码的区别: 代换密码 单表代换密码 字符或数学型 凯撒密码 仿射密码 四方密码 培根密码 图表 标准银河字母 圣堂武士密码 猪圈密码 ...

随机推荐

  1. parsing XML document from class path resource [applicationtext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationtext.xml] cannot be opened because it does not e

    控制台异常: parsing XML document from class path resource [applicationtext.xml]; nested exception is java ...

  2. Windows远程常见问题

    1.window2003远程桌面“已达最大连接数”解决:1)mstsc /v:(此处为服务器IP) /console   任务管理器注销已断开用户 mstsc /v:192.168.4.3 /cons ...

  3. 纯JS实现前端动态分页码

    思路分析:有3种情况 第一种情况,当前页面curPage < 4 第二种情况,当前页面curPage == 4 第三种情况,当前页面curPage>4 此外,还要考虑,当前页码 curPa ...

  4. ThinkPHP5.0框架事务处理操作简单示例

    本文介绍ThinkPHP5.0框架事务处理操作,结合实例形式分析了ThinkPHP5针对删除操作的事务处理相关操作技巧,可以加深对ThinkPHP源码的理解,需要的朋友可以参考下 事务的调用在mysq ...

  5. ZYNQ的Linux Linaro系统镜像制作SD卡启动

    ZYNQ的Linux Linaro系统镜像制作SD卡启动 0. 概述 ZYNQ生成uboot的时候和正常的ARM设备不太一样,ZYNQ属于二次辅助启动uboot然后由uboot启动内核,大概意思就是 ...

  6. Django学习之mysql结果显示

    背景:向数据库添加相同名字的用户 上节可知,在查询某个用户信息时,只能查看到行数但不能查看结构性信息. fetchone()函数可以但仅可逐个查看结构性信息.查不到信息将以None替补. fetchA ...

  7. Active MQ C++实现通讯记录

    Active MQ  C++实现通讯 背景知识: ActiveMQ是一个易于使用的消息中间件. 消息中间件 我们简单的介绍一下消息中间件,对它有一个基本认识就好,消息中间件(MOM:Message O ...

  8. ssm中需要注意的问题

    1.在controller中需要加注解 @Controller @RequestMapping("url") @Autowired private CardService card ...

  9. 苏州Uber优步司机奖励政策(3月28日~3月30日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  10. P2351 [SDOi2012]吊灯

    P2351 [SDOi2012]吊灯 https://www.luogu.org/problemnew/show/P2351     题意: 一棵树,能否全部分成大小为x的联通块. 分析: 显然x是n ...