文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Ancient Cipher--POJ 2159

Ancient Cipher--POJ 2159

时间:2010-08-17  来源:勇泽

1、题目类型:哈希表。

2、解题思路:水题。

3、注意事项:哈希公式。

4、实现方法:

#include<iostream>
using namespace std;
#define Max 26
int anum[Max],bnum[Max];
int main()
{
int i,ahash,bhash;
char ch;
while((ch=getchar())!='\n')
++anum[ch-'A'];
while((ch=getchar())!='\n')
++bnum[ch-'A'];
for(i=0;i<Max;i++)
{
ahash
+=anum[i]*anum[i];
bhash
+=bnum[i]*bnum[i];
}
if(ahash==bhash)
cout
<<"YES"<<endl;
else
cout
<<"NO"<<endl;
return 1;
}

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载