Ancient Cipher UVa1339
这题就真的想刘汝佳说的那样,真的需要想象力,一开始还不明白一一映射是什么意思,到底是有顺序的映射?还是没顺序的映射?
答案是没顺序的映射,只要与26个字母一一映射就行
下面给出代码
//Uva1339 //Ancient Cipher //easy #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { freopen("Ancient.in","r",stdin); freopen("Ancient.out","w",stdout); ], s2[]; ) { int n = strlen(s1); ], cnt2[]; memset(cnt1, , sizeof(cnt1)); memset(cnt2, , sizeof(cnt2)); ; i < n; i++)cnt1[s1[i] - 'A']++; ; i < n; i++)cnt2[s2[i] - 'A']++; sort(cnt1, cnt1 + ); sort(cnt2, cnt2 + ); ; ; i < ; i++) ; if(ok)printf("YES\n"); else printf("NO\n"); } ; }
Ancient Cipher UVa1339的更多相关文章
- uva--1339 - Ancient Cipher(模拟水体系列)
1339 - Ancient Cipher Ancient Roman empire had a strong government system with various departments, ...
- 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 一开始说好这个是个水题,就按照水题的想法来看,唉~ 最后还是懵逼了,感觉太复杂了,一开始想要排序两串字符,然后移动之类的,但是看了看 好 ...
- 2159 -- Ancient Cipher
Ancient Cipher Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 36074 Accepted: 11765 ...
- [算法竞赛入门经典]Ancient Cipher, NEERC 2004,UVa1339
Description Ancient Roman empire had a strong government system with various departments, including ...
随机推荐
- html 上传文件
1.html代码 <form id="form1" action="TestYield" method="post" enctype= ...
- linux mint运行docker
1,sudo apt-get install docker.io 或者sudo apt-get install docker* 2,安装好之后 sudo docker -d 启动进程提示: yimiy ...
- zip-auto.sh
#!/bin/sh #auto zip package #Define Path #####test######### mkdir -p /root/shell/test1 /root/shell/t ...
- chrome的功能Copy as cURL
https://segmentfault.com/q/1010000002508961
- DEV组件LookupEdit,ComboBoxEdit绑定数据源
LookupEdit可以绑定数据表(DataTable)或对象数据组(Object List)作为数据源,下拉窗体可自定显示栏位. 绑定数据源需要设置三个参数:DisplayMember ,Value ...
- vim列编辑
命令模式下:ctrl + v(我在gvim,win7中是ctrl +shift + q)进入列编辑模,选中要编辑的行(j 上,k下) 输入 “I” (大写的 I,光标定位到选中的第一行),输入要编辑的 ...
- mysql 子查询优化
今天用到要查询七天内都没有装机的门店信息,首先想到了用not in,先把装机的userid查出来,然后再id not in,但是这样就必须使用子查询,数据量少还可以,数据量大了的话,肯定效率特别低,因 ...
- php字符串比较
比较两个字符串是否相等,最常见的方法就是使用“===”来判断,至于它和“==”的区别,简单来说 就是前者强调“identical”类型也要求一样:后者要求“equal”,值相同就可以了.或者使用str ...
- BZOJ 2038: [2009国家集训队]小Z的袜子(hose)&&莫对算法
这里跟曼哈顿最小生成树没有太大的关系. 时间复杂度证明: [BZOJ2038 小Z的袜子 AC代码] 排序方式: 第一关键字:l所在的块: 第二关键字:r从小到大. #include<cstdi ...
- 贴一份用delphi修改注册表改网卡MAC地址的代码
//提示:此代码需要use Registry, Common; function WriteMAC(model:integer):integer; var reg:TRegistry; begin r ...