UVA - 1339 Ancient Cipher
来源:互联网 发布:小米数据迁移 分身 编辑:程序博客网 时间:2024/06/14 11:25
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int i,j,len,num;
int cnt1[30],cnt2[30];
char st1[105],st2[105];
while(~scanf("%s",st1))
{
num=0;
scanf("%s",st2);
memset(cnt1,0,sizeof(cnt1));
memset(cnt2,0,sizeof(cnt2));
len=strlen(st1);
for(i=0;i<len;i++)
{
cnt1[st1[i]-'A']++;
cnt2[st2[i]-'A']++;
}
sort(cnt1,cnt1+26);
sort(cnt2,cnt2+26);
for(i=0;i<26;i++)
if(cnt1[i]==cnt2[i]) num++;
if(num==26) printf("YES\n");
else printf("NO\n");
}
return 0;
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int i,j,len,num;
int cnt1[30],cnt2[30];
char st1[105],st2[105];
while(~scanf("%s",st1))
{
num=0;
scanf("%s",st2);
memset(cnt1,0,sizeof(cnt1));
memset(cnt2,0,sizeof(cnt2));
len=strlen(st1);
for(i=0;i<len;i++)
{
cnt1[st1[i]-'A']++;
cnt2[st2[i]-'A']++;
}
sort(cnt1,cnt1+26);
sort(cnt2,cnt2+26);
for(i=0;i<26;i++)
if(cnt1[i]==cnt2[i]) num++;
if(num==26) printf("YES\n");
else printf("NO\n");
}
return 0;
}
心得:昨天做的,题意很难懂,要不是看紫书根本想不出来。。。还有,第一次sort函数的使用,居然是快速排序,醉了。。。
0 0
- UVA 1339 - Ancient Cipher
- uva 1339 Ancient Cipher
- Uva - 1339 - Ancient Cipher
- UVA 1339 - Ancient Cipher
- UVa:1339 Ancient Cipher
- UVA 1339 - Ancient Cipher
- UVA-1339 - Ancient Cipher
- UVa 1339 Ancient Cipher
- UVa 1339 Ancient Cipher
- UVa 1339 - Ancient Cipher
- UVa 1339 - Ancient Cipher
- uva 1339Ancient Cipher
- UVa 1339 - Ancient Cipher
- Uva 1339 - Ancient Cipher
- 【Uva 1339】 Ancient Cipher
- UVa-1339 - Ancient Cipher
- Uva - 1339 - Ancient Cipher
- UVA - 1339 Ancient Cipher
- LeetCode Algorithms #100 <Same Tree>
- Spring Boot实践应用开发(8)
- 2007年NOIP提高组 统计数字
- C++与类型转换相关的四个关键字及其特点
- GNS3-IOUVM 更改IP地址为静态
- UVA - 1339 Ancient Cipher
- 面试题——Spring作用
- 一切皆为对象
- 【vim环境配置】详细实录
- vs2005断点无效
- JS函数式编程【译】4.4 函数式响应式编程
- java操作符
- Javascript中实现不加new关键字的构造函数
- 3D打印技术之切片引擎(7)