题目

https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1214

题意

问字符串a能否是字符串b经过某种替换+移位密码的密文

思路

明显,计数对的上就行

刘书题目描述不全面

代码

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#define LOCAL_DEBUG
using namespace std;
typedef pair<int, int> MyPair;
int cnta[];
int cntb[]; bool judge(string a, string b) {
memset(cnta, , sizeof cnta);
memset(cntb, , sizeof cntb);
for (int i = ; i < a.size(); i++) {
cnta[a[i]]++;
cntb[b[i]]++;
}
sort(cnta, cnta + );
sort(cntb, cntb + );
for (int i = ; i < ; i++) {
if (cnta[i] != cntb[i])return false;
}
return true;
} int main() {
#ifdef LOCAL_DEBUG
freopen("C:\\Users\\Iris\\source\\repos\\ACM\\ACM\\input.txt", "r", stdin);
//freopen("C:\\Users\\Iris\\source\\repos\\ACM\\ACM\\output.txt", "w", stdout);
#endif // LOCAL_DEBUG
int T;
string a, b;
for (int ti = ;cin>>a>>b; ti++) {
if (judge(a, b))puts("YES");
else puts("NO");
} return ;
}

UVa LA 3213 - Ancient Cipher 水题 难度: 0的更多相关文章

  1. UVa 10340 - All in All 水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  2. UVa 3602 - DNA Consensus String 水题 难度: 0

    题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...

  3. UVa 1339 Ancient Cipher --- 水题

    UVa 1339 题目大意:给定两个长度相同且不超过100个字符的字符串,判断能否把其中一个字符串重排后,然后对26个字母一一做一个映射,使得两个字符串相同 解题思路:字母可以重排,那么次序便不重要, ...

  4. LA 3213 Ancient Cipher (水题,转化)

    题意:给定两个长度相同的字符串,判断它们之间是否存在一一对应关系,顺序不定. 析:刚开始没看到顺序不定,然后写完没胡把样例看完就交了,结果WA了一次...其实这是一个水题,既然顺序不定,那么更简单,我 ...

  5. UVa 10970 - Big Chocolate 水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  6. UVa 11039 - Building designing 贪心,水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  7. UVa 11636 - Hello World! 二分,水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  8. LA 3213 Ancient Cipher

    开始我理解错题意了,应该是这样理解的: 字符串1进行映射后可以做一个置换,若置换后与字符串2相同,也是输出YES的 比如ABCA 和 DDEF 因此我们需要做的就是统计有多少类字母,每一类有多少个,如 ...

  9. hdu 3687 10 杭州 现场 H - National Day Parade 水题 难度:0

    H - National Day Parade Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & % ...

随机推荐

  1. Android AndFix修复方式的限制

    这里阅览了很多网上关于修复的资料,一一贴在这里便于查看: https://github.com/alibaba/AndFix  这是官方处  要了解使用,一定得看看这里. http://www.jia ...

  2. git 放弃本地修改

     本文以转移至本人的个人博客,请多多关注! 如果在修改时发现修改错误,而要放弃本地修改时, 一, 未使用 git add 缓存代码时. 可以使用 git checkout -- filepathnam ...

  3. redhat修改网卡名称

    ●此方法在redhat7.4之后,不能修改成功. 1.编辑网卡的配置文件 vi /etc/sysconfig/network-scripts/ifcfg-ens33 将里面的NAME和DEVICE项修 ...

  4. 牛客国庆集训派对Day3 G Stones

    Stones 思路: sg函数打表找规律 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #in ...

  5. 推送消息 web push notification

    参考 : https://developers.google.com/web/fundamentals/engage-and-retain/push-notifications/   ( step b ...

  6. 虚拟机中不能连接usb设备解决办法

    虚拟机中不能连接usb设备解决办法 1.点击开始->运行,在对话框中输入"services.msc",确定,打开windows服务管理器.2.在服务列表中选中"VM ...

  7. legend2---开发日志7(vue的使用场景有哪些,或者说使用的优缺点)

    legend2---开发日志7(vue的使用场景有哪些,或者说使用的优缺点) 一.总结 一句话总结:任何页面都可以使用vue,尤其是有交互的或者用ajax的,但是vue插件及其它各种插件加载需要时间, ...

  8. ubuntu下安装Firefox中国版解决Ubuntu与Windows下Firefox账号同步问题(已解决)

    1. 下载最新版本火狐Linux版 下载地址:http://firefox.com.cn/download/ 选择火狐Linux64-bit版,下载后文件为:Firefox-latest-x86_64 ...

  9. 如何理解机器学习/统计学中的各种范数norm | L1 | L2 | 使用哪种regularization方法?

    参考: L1 Norm Regularization and Sparsity Explained for Dummies 专为小白解释的文章,文笔十分之幽默 why does a small L1 ...

  10. Django使用admin管理后台管理数据库表

    1.在admin.py文件中注册需要创建的表,例: from .models import * # Register your models here. admin.site.register(Use ...