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 ...
随机推荐
- [转载] 理解 epoll 的事件触发机制
原文: http://weibo.com/p/1001603862394207076573?sudaref=weibo.com epoll的I/O事件触发方式有两种模式:ET(Edge Trigger ...
- Oracle 中union的用法
UNION 指令的目的是将两个 SQL 语句的结果合并起来,可以查看你要的查询结果. 例如: SELECT Date FROM Store_Information UNION SELECT Date ...
- SQL SERVER 2008函数大全(含例子)
--SQL SERVER 2008 函数大全 /* author:TracyLee csdncount:Travylee */ /* 一.字符串函数: 1.ascii(字符串表达式) 返回字符串 ...
- virtualbox中centos系统配置nat+host only上网(zhuan)
http://www.cnblogs.com/leezhxing/p/4482659.html **************************************************** ...
- linux下tftp安装与设置
在学习linux+arm开发的时候,tftp和NFS是必不可少的环境.这里总结一下自己安装和使用tftp的一些经验,做个备忘. 一.tftp服务原理 tftp(trivial file transfe ...
- dedecms 模板文件不存在,无法解析文档"的终极各种解决办法
方法一:[此对应喜欢把模板文件使用".html"的格式,] /include/arc.archives.class.php 556行 if (!preg_match(&qu ...
- maven 添加支持编译jdk1.7
1.在<profiles>元素内增加如下内容 <profile> <id>jdk17</id> <activation> ...
- fushioncharts的使用教程
FusionCharts 是使用javascript 实现统计图表的js组件:其官网地址:http://www.fusioncharts.com.其早期版本FusionCharts Free 是基于f ...
- arithmetic
字典序算法 http://www.cnblogs.com/darklights/p/5285598.html 字典排序(lexicographical order)是一种对于随机变量形成序列的排序方法 ...
- js二级导航
js写二级导航要点 1.ul li 2.js获取元素 3.setInterval(function(),time); 代码如下 <style type="text/css"& ...