POJ 2159 Ancient Cipher 难度:0
题目链接:http://poj.org/problem?id=2159
#include <cstring>
#include <cstdio>
#include <cctype>
char ch1[102];
char ch2[102];
int n1[102];
int n2[102];
int ch1n[26];
int ch2n[26];
int main(){
scanf("%s %s",ch2,ch1);
int len=strlen(ch1);
if(strlen(ch2)!=len){
printf("NO\n");
return 0;
}
for(int i=0;i<len;i++){
int ti=ch1[i]-'A';
int tj=ch2[i]-'A';
ch1n[ti]++;
ch2n[tj]++;
}
for(int i=0;i<26;i++){
n1[ch1n[i]]++;
n2[ch2n[i]]++;
}
for(int i=0;i<102;i++){
if(n1[i]!=n2[i]){
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
}
POJ 2159 Ancient Cipher 难度:0的更多相关文章
- POJ 2159 Ancient Cipher
题意:被题意杀了……orz……那个替换根本就不是ASCII码加几……就是随机的换成另一个字符…… 解法:只要统计每个字母的出现次数,然后把数组排序看相不相同就行了…… 代码: #include< ...
- 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 ...
- POJ 1068 Parencodings 模拟 难度:0
http://poj.org/problem?id=1068 #include<cstdio> #include <cstring> using namespace std; ...
- 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, ...
- UVa1399.Ancient Cipher
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- POJ2159 Ancient Cipher
POJ2159 Ancient Cipher Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 38430 Accepted ...
随机推荐
- RAR暴破
1. 网上稍微搜索了一下,貌似一个叫 "ARPR"的软件 出现的频率较高. 2. http://jingyan.baidu.com/article/a948d651b954a90a ...
- bootstrap学习笔记<六>(表单二之按钮)
按钮(补充) (ps:居中元素可以使用<center></center>标签) 块级按钮(ps:按钮占一整行) <button class="btn btn-p ...
- JS 对象(Object)和字符串(String)互转
利用原生JSON对象,将对象转为字符串 var jsObj = {}; jsObj.testArray = [1,2,3,4,5]; jsObj.name = 'CSS3'; jsObj.date = ...
- Linux下搭建SVN服务
SVN有几种方式进行访问,比较常见的是通过自带协议访问(svn://),配置很简单,还有一种就是http协议访问,需要结合apache服务,配置相对繁琐. 安装svn yum -y install s ...
- JavaSE复习_6 枚举类
△单例类是指只有一个实例,而枚举类实际上就是有有限个实例的类,在类里已经把实例定义好了. △枚举类的三种创建形式: 1) enum Week { MON,TUE,WED;//枚举类有默认构造函数创建的 ...
- golang 定时器
上网查了下相关资料,基本上都介绍的是github.com\robfig\cron这个包来执行定时任务,试了下确实可以执行.但是此包下没有删 除任务的方法,只有暂停的方法(Stop),若要停止之前的任务 ...
- [css] 垂直居中方法
原文链接:http://www.cnblogs.com/2050/p/3392803.html 一.text-algin:center; 适用于行内元素水平居中,如图片.按钮.文字, 但是在IE67下 ...
- android textview段落开头空格问题
textview中段落开头一般都会空2格排版显示,如果靠编辑空格来解决那就大错特错了,完美的解决方法就是用转义字符"\t",在段首加\t\t就解决啦!
- php内存处理须知【转】
04 Mar 11 深入理解PHP内存管理之谁动了我的内存 作者: Laruence( ) 本文地址: http://www.laruence.com/2011/03/04/1894.html 转 ...
- SpringMVC简单构造restful, 并返回json
https://my.oschina.net/u/2272916/blog/352297