POJ 2159 Ancient Cipher
题意:被题意杀了……orz……那个替换根本就不是ASCII码加几……就是随机的换成另一个字符……
解法:只要统计每个字母的出现次数,然后把数组排序看相不相同就行了……
代码:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<time.h>
#include<stdlib.h>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#define LL long long using namespace std; int main()
{
string s1, s2;
while(cin >> s1 >> s2)
{
vector <int> v1, v2;
for(int i = 0; i < 26; i++)
{
v1.push_back(0);
v2.push_back(0);
}
for(int i = 0; i < s1.size(); i++)
{
v1[s1[i] - 'A']++;
v2[s2[i] - 'A']++;
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
if(v1 == v2) puts("YES");
else puts("NO");
}
return 0;
}
POJ 2159 Ancient Cipher的更多相关文章
- POJ 2159 Ancient Cipher 难度:0
题目链接:http://poj.org/problem?id=2159 #include <cstring> #include <cstdio> #include <cc ...
- Poj 2159 / OpenJudge 2159 Ancient Cipher
1.链接地址: http://poj.org/problem?id=2159 http://bailian.openjudge.cn/practice/2159 2.题目: Ancient Ciphe ...
- 2159 -- Ancient Cipher
Ancient Cipher Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 36074 Accepted: 11765 ...
- POJ2159 ancient cipher - 思维题
2017-08-31 20:11:39 writer:pprp 一开始说好这个是个水题,就按照水题的想法来看,唉~ 最后还是懵逼了,感觉太复杂了,一开始想要排序两串字符,然后移动之类的,但是看了看 好 ...
- poj 2159 D - Ancient Cipher 文件加密
Ancient Cipher Description Ancient Roman empire had a strong government system with various departme ...
- 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个字母一一做一个映射,使得两个字符串相同 解题思路:字母可以重排,那么次序便不重要, ...
- UVa1399.Ancient Cipher
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- Ancient Cipher UVa1339
这题就真的想刘汝佳说的那样,真的需要想象力,一开始还不明白一一映射是什么意思,到底是有顺序的映射?还是没顺序的映射? 答案是没顺序的映射,只要与26个字母一一映射就行 下面给出代码 //Uva1339 ...
随机推荐
- HUSTOJ(转发)
来源:http://blog.csdn.net/xiajian2010/article/details/12954855 缘起 大四了,快毕业了,所以想准备点LAMP的知识和经验.刚好实验室里有人在搞 ...
- lintcode:最大子正方形
题目: Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square contain ...
- hdu 2149 Public Sale (博弈规律题)
#include<stdio.h> int main() { int n,m; while(scanf("%d %d",&m,&n)!=EOF) { ) ...
- C 语言学习guideline
Kernighan和Ritchie的<The C Programming Language>(中译名<C程序设计语言>)堪称经典中的经典,不过旧版的很多内容都已过时,和现在的标 ...
- go的优缺点
1.1 不允许左花括号另起一行1.2 编译器莫名其妙地给行尾加上分号1.3 极度强调编译速度,不惜放弃本应提供的功能1.4 错误处理机制太原始1.5 垃圾回收器(GC)不完善.有重大缺陷1.6 禁止未 ...
- PowerDesigner连接Oracle数据库建表序列号实现自动增长
原文:PowerDesigner连接Oracle数据库建表序列号实现自动增长 创建表就不说了.下面开始介绍设置自动增长列. 1 在表视图的列上创建.双击表视图,打开table properties — ...
- Java API —— BigInteger类
1.BigInteger类概述 可以让超过Integer范围内的数据进行运算 2.构造方法 public BigInteger(String val) 3.BigInteger类 ...
- Collection_Compare
冒泡 package com.bjsxt.sort.bubble; import java.util.Arrays; public class BubbleSort1 { /** * @param a ...
- spring+hibernate+Struts2 整合(全注解及注意事项)
最近帮同学做毕设,一个物流管理系统,一个点餐系统,用注解开发起来还是很快的,就是刚开始搭环境费了点事,今天把物流管理系统的一部分跟环境都贴出来,有什么不足的,请大神不吝赐教. 1.结构如下 2.jar ...
- C#开发BHO插件UrlTrack
最近忽然突发奇想,想统计一下我最经常上的网站是哪些,并且在这些网站上都停留了多久.为此决定写一个BHO插件来做这件事. BHO(Browser Help Objects)是实现了特定接口(IObjec ...