Bacon's Cipher(培根密码)
Description
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
Output
Sample Input
Sample Output
#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(培根密码)的更多相关文章
- HDU4144:Bacon's Cipher
Problem Description Bacon's cipher or the Baconian cipher is a method of steganography (a method of ...
- [CTF]培根密码
[CTF]培根密码 --------------------- 作者:adversity` 来源:CSDN 原文:https://blog.csdn.net/qq_40836553/articl ...
- CTF密码学总结
CTF中那些脑洞大开的编码和加密 摘自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会遇到 ...
- CTF中编码与加解密总结
CTF中那些脑洞大开的编码和加密 转自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会遇到 ...
- [CTF]中那些脑洞大开的编码和加密
[CTF]中那些脑洞大开的编码和加密 摘自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会 ...
- CTF---密码学入门第二题 我喜欢培根
我喜欢培根分值:20 来源: Ph0enix 难度:中 参与人数:3449人 Get Flag:1410人 答题人数:1653人 解题通过率:85% key: CTF{} 解题链接: http://c ...
- CTF中常见密码题解密网站总结
0x00.综合 网站中包含大多编码的解码. http://web2hack.org/xssee/ https://www.sojson.com/ http://web.chacuo.net/ 0x01 ...
- JarvisOJ Basic 爱吃培根的出题人
听说你也喜欢吃培根?那我们一起来欣赏一段培根的介绍吧: bacoN is one of aMerICa'S sWEethEartS. it's A dARlinG, SuCCulEnt fOoD tH ...
- ctf古典密码从0到
本文首发于“合天智汇”公众号 作者:淡灬看夏丶恋雨 古典密码和现代密码的区别: 代换密码 单表代换密码 字符或数学型 凯撒密码 仿射密码 四方密码 培根密码 图表 标准银河字母 圣堂武士密码 猪圈密码 ...
随机推荐
- Xdebug 备注
安装步骤: 查看自己的环境是否已安装 Xdebug ,查看方法:使用phpinfo(),搜索 Xdebug 如果没有 如图: 如果没有:下一步确定你的PHP版本信息: Xdebug下载地址 https ...
- jar包导入本地maven库的操作
pom文件配置格式: <dependency> <groupId>A</groupId> <artifactId>B</artifactId> ...
- WebService 学习笔记(一、概念及定义)
定义 WebService是一种服务导向架构(SOA service-oriented architecture)的技术,通过标准的Web协议提供服务,目的是保证不同平台的应用服务可以互操作. Web ...
- 爬取豆瓣电影Top250
1 import json import requests from requests.exceptions import RequestException import re import time ...
- QWebView 与Js 交互
我本愚钝,在网上搜了一下没找到可以运行的栗子,遂在这记录一下吧. 环境:win10 64位系统 qt 4.8.7 (mingw32) qtcreator(4.5.0) 1. 建立一个 Widgets ...
- HyperLedger Fabric 1.4 官方End-2-End运行(8)
8.1 End-2-End案例简介 Fabric官方提供了实现点对点的Fabric网络示例,该网络有两个组织(organizations),一个组织有两种节点(Peer),通过Kafka ...
- Maximum sum
描述 Given a set of n integers: A={a1, a2,-, an}, we define a function d(A) as below: t1 t2 d(A) = max ...
- 破解有道词典在线翻译接口--python
没什么好说的,直接上代码. import requests # import json import time import random import hashlib translate = inp ...
- BZOJ3224_普通平衡树_KEY
题目传送门 平衡二叉树(Balanced Binary Tree)具有以下性质:它是一棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树.平衡二叉树的常用实现方法有红 ...
- 优步UBER司机全国各地奖励政策汇总 (3月14日-3月20日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...