⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hash_str.txt

📁 C精彩编程百例源码
💻 TXT
字号:
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

void hash_str(string a,string b)
{
	int i,j;
	int pri_hash,hash;
	int m=a.length(),n=b.length();
	int *pa=new int[m-1],*pb=new int[n-1];

	for(i=0;i<m-1;i++)
	{
		pri_hash=(int)a[i]*32+(int)a[i+1]*1024;
		hash=pri_hash%676;
		pa[i]=hash;
	}

		for(j=0;j<n-1;j++)
	{
		pri_hash=(int)b[j]*32+(int)b[j+1]*1024;
		hash=pri_hash%676;
		pb[j]=hash;
	}

		for(i=0;i<m-1;i++)
			cout<<pa[i]<<endl;

		for(j=0;j<n-1;j++)
			cout<<pb[j]<<endl;
}
int main(int argc, char* argv[])
{
	string a,b;
	cin>>a;
	cin>>b;
	hash_str(a,b);
	return 0;
}






while(j<=(int)(n/2))
	{
		if((2*j<n)&&(tree[2*j]<tree[2*j+1]))
			m=2*j+1;
		else
			m=2*j;
		if(tree[j]<tree[m])
		{
			swap(tree[j],tree[m]);
			j=m;
		}
		else j=n;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -