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 ...
随机推荐
- Memcache的安装
下载安装包: wget http://www.memcached.org/files/memcached-1.4.32.tar.gz wget https://cloud.github.com/dow ...
- Java 文件IO续
文件IO续 File类 用来将文件和文件夹封装成对象 方便对文件和文件夹的属性信息进行操作 File对象可以作为参数传递给流的构造函数 Demo1 File的构造方法 public cla ...
- D3.js 第一个程序 HelloWorld
一.HTML 是怎么输出 HelloWorld 的 <html> <head> <meta charset="utf-8"> <title ...
- 图像fft和wavelet变换矩阵和向量区别 dwt2和wavedec2联系
1. 对于小波变换,dwt2 :单级离散2维小波变换 wavedec2 :多级2-D小波分解 matlab中这两者联系是都能对图像进行小波分解,区别是dwt2是二维单尺度小波变换,只能对输入矩阵X一 ...
- Oracle session inactive状态临时表数据未清空问题
问题描述:Oracle数据库,java代码使用某数据库实例,获取connection并在使用结束关闭,而session未销毁,而是状态变为inactive从而导致临时表数据未清空. Oracle临时表 ...
- SAP SD你要知道的透明表
一.客户主数据 基本数据放在KNA1里: 公司代码放在KNB1里: 销售视图放在KNVV里: 合作伙伴放在KNVP里: 二.信用主数据 KNKK里有信贷限额.应收总额.特别往来: S066里是未清订单 ...
- 花生壳+Tomcat
花生壳(内网穿透)新手上路 http://service.oray.com/question/1664.html 好不容易找到一篇关于“花生壳+Tomcat”的好文章,转一下,上次自己弄的时候把自己的 ...
- 三张图彻底了解Java中字符串的不变性
转载: 三张图彻底了解Java中字符串的不变性 定义一个字符串 String s = "abcd"; s中保存了string对象的引用.下面的箭头可以理解为"存储他的引用 ...
- Tomcat卸载
1.以管理员身份打开cmd,执行以下命令: C:Windows\system32>cd C:\Program Files\apache-tomcat-7.0.69\bin C:\Program ...
- Javascript脚本应该放在哪里?
1.<head> <srcipt>在被调用的时候才执行(页面加载前执行)</script> </head> 2. <srcipt>在被调用的 ...