UVa1339 Ancient Cipher
#include <iostream>
#include <string>
#include <cstring> // for memset
#include <algorithm>
using namespace std;
int main()
{
int ce[26], co[26];
string encrypted, orginal;
string::size_type i, len;
ios::sync_with_stdio(false);
while (cin >> encrypted >> orginal)
{
memset(ce, 0, sizeof(ce));
memset(co, 0, sizeof(co));
len = orginal.length();
for (i = 0; i < len; ++i)
{
++ce[encrypted[i]-'A'];
++co[orginal[i]-'A'];
}
sort(ce, ce+26);
sort(co, co+26);
if (equal(ce, ce+26, co))
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
UVa1339 Ancient Cipher的更多相关文章
- uva--1339 - Ancient Cipher(模拟水体系列)
1339 - Ancient Cipher Ancient Roman empire had a strong government system with various departments, ...
- UVA1339 - Ancient Cipher 【字符串+排序】【紫书例题4.1】
题意:给定两个字符串,你可以替换或者置换,替换是指可以将相同的字母替换为任意一个字母,而置换是指将字母替换为下一个,如A替换B,B替换为C,,,Z替换为A.你需要判断是否可以通过一系列操作使两个字符串 ...
- Ancient Cipher UVa1339
这题就真的想刘汝佳说的那样,真的需要想象力,一开始还不明白一一映射是什么意思,到底是有顺序的映射?还是没顺序的映射? 答案是没顺序的映射,只要与26个字母一一映射就行 下面给出代码 //Uva1339 ...
- UVa 1339 Ancient Cipher --- 水题
UVa 1339 题目大意:给定两个长度相同且不超过100个字符的字符串,判断能否把其中一个字符串重排后,然后对26个字母一一做一个映射,使得两个字符串相同 解题思路:字母可以重排,那么次序便不重要, ...
- Poj 2159 / OpenJudge 2159 Ancient Cipher
1.链接地址: http://poj.org/problem?id=2159 http://bailian.openjudge.cn/practice/2159 2.题目: Ancient Ciphe ...
- UVa1399.Ancient Cipher
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- poj 2159 D - Ancient Cipher 文件加密
Ancient Cipher Description Ancient Roman empire had a strong government system with various departme ...
- POJ2159 Ancient Cipher
POJ2159 Ancient Cipher Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 38430 Accepted ...
- POJ2159 ancient cipher - 思维题
2017-08-31 20:11:39 writer:pprp 一开始说好这个是个水题,就按照水题的想法来看,唉~ 最后还是懵逼了,感觉太复杂了,一开始想要排序两串字符,然后移动之类的,但是看了看 好 ...
随机推荐
- WPF 三态按钮(PNG贴图)
原文 http://blog.csdn.net/power_YQ/article/details/7177183 <Window.Resources> Style x:Key=" ...
- [原]容器学习(二):动手模拟AOP
简单来说,Spring是一个轻量级的控制反转(IOC)和面向切面(AOP)的容器框架.上文已经介绍模拟IoC实现,这篇文章来动手模拟AOP. AOP简述 面向对象强调"一切皆是对象" ...
- mysql查询语句理解
看一个查询语句 ,)) as passcount FROM (SELECT b.user,b.full_name,b.user_group From login_log a LEFT JOIN vic ...
- C++默认参数与函数重载 注意事项
一.默认参数在C++中,可以为参数指定默认值.在函数调用时没有指定与形参相对应的实参时, 就自动使用默认参数. 默认参数的语法与使用:(1)在函数声明或定义时,直接对参数赋值.这就是默认参数:(2)在 ...
- poj2840
#include <stdio.h> #include <stdlib.h> #include<string.h> int main() { int n,len; ...
- OA项目之打印
打印 若此页有一个打印按钮: <input type="button" id="btnPrint" class="button_sm7" ...
- 04737_C++程序设计_第7章_类模板与向量
例7.1 使用类模板的实例. 例7.2 求4个数中最大值的类模板程序. #include <iostream> using namespace std; template <clas ...
- Android Afinal框架学习(二) FinalActivity 一个IOC框架
框架地址:https://github.com/yangfuhai/afinal 相应的源代码: net.tsz.afinal.annotation.view.* FinalActivity Fina ...
- HDU 4937 Lucky Number 规律题_(:зゝ∠)_
把全部合法的进制打出来会发现合法的进制都是在 n/3 n/4 n/5的边上 然后暴力边上的进制数.. #include <cstdio> #include <set> type ...
- matlab GUI之自定义菜单小结
自定义菜单 1.uimenu对象 h=uimenu('PropertyName','ProperValue') h=uimenu(parent,'PropertyName','ProperValue' ...