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. 09JavaScript函数

    函数是由事件驱动的或者当它被调用时执行的可重复使用的代码块. 实例1: <!DOCTYPE html> <html> <head> <meta charset ...

  2. Python入门 —— 05时间日期处理小结

    此文多涉及基础,如果想要深入理解则到文末,有提供链接 涉及对象 1. datetime 2. timestamp 3. time tuple 4. string 5. date - datetime基 ...

  3. 如何快速生成数据库字典(thinkphp5.0)

    本教程将教你快速生成数据库字典 示例代码使用PHP框架:Thinkphp5.0 PHP代码: /** * 生成数据库字典html * 可直接另存为再copy到word文档中使用 * * @return ...

  4. JZOJ 4273. 【NOIP2015模拟10.28B组】圣章-精灵使的魔法语

    4273. [NOIP2015模拟10.28B组]圣章-精灵使的魔法语 (File IO): input:elf.in output:elf.out Time Limits: 1000 ms  Mem ...

  5. QP总体结构

    QP是一个基于事件驱动的嵌入式系统软件框架,其总体结构如下图. AO活动对象由事件队列和层次状态机两部分组成,每个AO占有一个优先级: QF量子框架由五个数据结构及操作组成,其数据结构采用了uCOS- ...

  6. PADS随记

    在PADS,PCB板设计中,怎么一次就把丝印的大小设置好? CTRL+ALT+F  组合键 打开 选择过滤器(Filter) 如下图 去掉其他的勾选,只选择 Labels . 之后在板子上鼠标拖动选上 ...

  7. linux学习--字符设备驱动

    目录 1.字符设备驱动抽象结构 2.设备号及设备节点 2.1 设备号分配与管理 2.2 设备节点的生成 3.打开设备文件 linux驱动有基本的接口进行注册和卸载,这里不再做详细说明,本文主要关注li ...

  8. 20145202马超 2016-2017-2《Java程序设计》课程总结

    学号 2016-2017-2<Java程序设计>课程总结 (按顺序)每周作业链接汇总 预备作业1(http://www.cnblogs.com/tuolemi/p/6193756.html ...

  9. 实现动态的XML文件读写操作(依然带干货)

    前言 最近由于项目需求,需要读写操作XML文件,并且存储的XML文件格式会随着导入的数据不同而随时改变(当然导入的数据还是有一定约束的),这样我们要预先定义好XML文件的格式就不太现实了,如何实现不管 ...

  10. BZOJ1588_营业额统计_KEY

    题目传送门 分析题意可得,希望求与每个数最相近的数. 二叉搜索树的简单题,因为可能被卡成O(N),考虑平衡树. 因为Treap较简单,此处用Treap编写代码. code: #include < ...