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. FreeImage 生成带透明通道的GIF

    主要方法: 加载图像及读取参数 FreeImage_Load FreeImage_GetWidth FreeImage_GetHeight FreeImage_Allocate FreeImage_G ...

  2. 编程界失传秘术,SSO单点登录,什么是单点,如何实现登录?

    单点登录 多系统,单一位置登录,实现多系统同时登录的一种技术. 常出现在互联网应用和企业级平台中. 如:京东. 单点登录一般是用于互相授信的系统,实现单一位置登录,全系统有效的. 三方登录:某系统,使 ...

  3. 利用binlog2sql闪回丢失数据

        today,i'll using the open source tool named "binlog2sql" which is release by danfengch ...

  4. jsp页面通过EL表达式获取list大小兼容性处理

    1.jsp页面通过EL表达式获取list大小,中间件用tomcat7时,下面这个写法是可以的 <input id="test" type="hidden" ...

  5. 百度地图定位JSP代码

    附:百度地图API:http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html#a1b0?qq-pf-to=pcqq.c2c &l ...

  6. UEditor显示Invalid or unexpected token

    原文链接http://www.qqdeveloper.com/a/53.html 问题背景    数据修改操作,需要做一个数据内容回显,该内容中包含代码.图片.普通文本等等内容,反正就是各种内容. 当 ...

  7. eclipse创建maven项目及Javaweb项目

    1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显示创建maven项目的窗口 3.在搜索框中搜索“web”,选择,n ...

  8. laravel 安装添加多站点

    官方文档如下 https://learnku.com/laravel/t/1160/laravel-nginx-multi-site-configuration

  9. Python 爬虫 (二)

    cookiejar模块: 管理储存cookie,将传出的http请求添加cookie cookie存储在内存中,CookieJar示例回收后cookie将自动消失 实例:用cookjar访问人人网主页 ...

  10. C++的特点

    C和C++ C主要是应用在在驱动层,是面向过程的编程语言,对类型的定义不是很严格.C++主要是应用与应用层,是C语言的一个加强版,可以完全兼容C语言,并且还有很多C语言不具备的特性,如,C++是一种面 ...