POJ2159 Ancient Cipher
来源:互联网 发布:iphone7数据恢复失败 编辑:程序博客网 时间:2024/05/17 22:04
题目大意:字符串加密问题,采用字符替换和重新排列的综合方法加密。输入为加密串和字符串,不含空格的大写字母。
解题思路:两种加密方法在具体过程中应用并不唯一,即我们不知道具体的加密过程,所以只需统计出现字符的种类和不同种类次数,且排续后完全相同,则判定为加密字符串。
#include <iostream>#include <algorithm> using namespace std; #define MAXN 260 char strA[MAXN];char strB[MAXN];int cntA[MAXN];int cntB[MAXN]; int main(){scanf("%s%s",strA,strB); int len=strlen(strB); for(int i=0;i<len;i++) cntA[strA[i]-'A']++;for(int i=0;i<len;i++) cntB[strB[i]-'A']++; sort(cntA,cntA+26);sort(cntB,cntB+26); bool ok=true;for(int i=0;i<26;i++)if(cntA[i]!=cntB[i]){ok=false;break;} if(ok) printf("YES\n");else printf("NO\n"); return 0;}
0 0
- POJ2159 Ancient Cipher
- Ancient Cipher--POJ2159
- POJ2159 Ancient Cipher
- POJ2159 Ancient Cipher
- poj2159 Ancient Cipher
- poj2159 Ancient Cipher
- poj2159 Ancient Cipher
- [POJ2159]Ancient Cipher
- poj2159 Ancient Cipher 水题
- POJ2159 Ancient Cipher
- POJ2159 Ancient Cipher【字符密码】
- POJ2159——Ancient Cipher
- POJ2159,Ancient Cipher,水题,简单的思路
- UVA1339 UVALive3213 POJ2159 ZOJ2658 Ancient Cipher
- Ancient Cipher
- Ancient Cipher
- Ancient Cipher
- Ancient Cipher
- java基础第三天it18掌
- bzoj2179 FFT快速傅立叶
- 12-JS特效-事件监听原理
- Mac下配置apache,PHP,mysql以及phpmyadmin服务器环境遇到的坑以及解决方式
- 订单信息表单设计
- POJ2159 Ancient Cipher
- Android手动修改DNS的方法
- 2017年初面向java小白配置mac版jdk的方法
- 我的2016
- 多媒体页面设计
- 用Qt5编译QFtp
- angular源码解读:$apply方法
- Python爬虫讲座初探
- JSP表格页面布局问卷调查