题目

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. 由table理解display:table-cell

    转载自:https://segmentfault.com/a/1190000007007885 table标签(display:table) 1) table可设置宽高.margin.border.p ...

  2. docker下debian镜像开启ssh, 允许root用密码登录

    用的官方python镜像做开发, 暴露端口, 用pycharm ssh进去开发. 忽然发现本来ssh能连上, 但是更了新的python镜像连不上了. 有折腾了一下, 连上了. 主要是python官网镜 ...

  3. 分析:java.lang.OutOfMemoryError: Java heap space

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Hashta ...

  4. 取代iframe框架

    一.frameset1. 属性①border设置框架的边框粗细.②bordercolor设置框架的边框颜色.③frameborder设置是否显示框架边框.设定值只有0.1:0 表示不要边框,1 表示要 ...

  5. 2017-2018-2 20165303 实验三《Java面向对象程序设计》实验报告

    实验三 敏捷开发与XP实践-1 实验要求 实验三 敏捷开发与XP实践 http://www.cnblogs.com/rocedu/p/4795776.html, Eclipse的内容替换成IDEA 参 ...

  6. English trip V1 - 21. I dreamed dream Teacher:Corrine Key: past tense(过去式)

    In this lesson you will learn to describe an experience.  本课将会学习描述一次经历 课上内容(Lesson) 词汇(Key Word ) # ...

  7. linux之bash shell

    GNU bash ======================================================== 通常计算机硬件是由运算器.控制器.存储器.输入/输出设备等等这些物理 ...

  8. Div不用float布局

    CSS代码 .wrapper1_4 { width: 100%; /* 也可以固定宽度 */ height: 26px; } .wrapper1_4 > .left { display: inl ...

  9. 对比react和vue

    相同点 都有组件化开发和virtual DOM(具体实现方式不同) 都支持props进行父子组件间数据通信 都支持数据驱动,不直接操作真实DOM,更新状态数据,界面自动更新 都支持服务器渲染 都支持n ...

  10. Laravel中APP_KEY起什么作用

    框架中是这样描述的: This key is used by the Illuminate encrypter service and should be set to a random, 32 ch ...