文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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;
}

 

相关阅读 更多 +
排行榜 更多 +
这一关太烧脑

这一关太烧脑

休闲益智 下载
改善老人生活

改善老人生活

飞行射击 下载
跑酷大冲刺最新版

跑酷大冲刺最新版

休闲益智 下载