常用算法设计方法3
发布时间:2006-07-25 12:02
点击:
分页:
上一页 1 2 3 4 5 6 7 8 [9] 10 下一页
int selectnum(int start)
{ int j;
for (j=start;j<=N;j++)
if (b[j]) return j
return 0;
}
int check(int pos)
{ int i,j;
if (pos<0) return 0;
for (i=0;(j=checkmatrix[pos][i])>=0;i++)
if (!isprime(a[pos]+a[j])
return 0;
return 1;
}
int extend(int pos)
{ a[++pos]=selectnum(1);
b[a][pos]]=0;
return pos;
}
int change(int pos)
{ int j;
while (pos>=0&&(j=selectnum(a[pos]+1))==0)
b[a[pos--]]=1;
if (pos<0) return –1
分页:
上一页 1 2 3 4 5 6 7 8 [9] 10 下一页
版权申明:未经书面授权请勿转载本站信息!!作品版权归所属媒体与作者所有!!
|
您将承担一切因您的行为、言论而直接或间接导致的民事或刑事法律责任
留言板管理人员有权保留或删除其管辖留言中的任意内容
本站提醒:不要进行人身攻击。谢谢配合。
|