回溯法
来源:互联网 发布:网络销售彩票聊天技巧 编辑:程序博客网 时间:2024/04/29 15:22
/*
#include<stdio.h>
int comb_back(int n,int r)
{
int *a=new int[r];
int i=0;
int a[i]=1;
int count=0;
while(a[i]-i<n-r+1)
{
if(i==r-1)
{
for(int j=0;j<r;j++)
{
count++;
printf("µÚ%d×é: %d ",count,a[j]);
}
printf("/n");
continue;
}
i++;
a[i]=a[i-1];
a[i]++;
}
return 0;
}
*/
/*
//»ØËÝ·š
#include<stdio.h>
int main()
{
int n=5,r=3;
int a[100];
// int *a=new int[r];
int i=0;
a[i]=1;
int count=0;
do{
if(a[i]-i<=n-r+1)
{
if(i==r-1)
{
for(int j=0;j<r;j++)
{
count++;
printf("%d ",a[j]);
}
printf("/n");
// continue;
a[i]++;
continue;
}
i++;
a[i]=a[i-1];
a[i]++;
}
else
{
if(i==0) return 0;
i--;
a[i]++;
}
}while(1);
return 0;
}
*/
/*
#include<stdio.h>
int main()
{
int m=7,r=3;
int result[100];
int i=0;
result[i]=1;
int remain=m-result[i];
int mnt=m/r;
while(result[0]<=mnt)
{
if(i==r-1)
{
result[i]+=remain;
for(int j=0;j<r;j++)
{
printf("%d ",result[j]);
}
printf("/n");
result[i-1]++;
remain=result[i]-1;
i--;
// result[i]=0;
}
else if(remain>=result[i])
{
i++;
result[i]=result[i-1];
remain-=result[i];
}
else//Àý1 3 3 £>2
{
if(i==0) return 0;
i--;
result[i]++;
remain=remain+result[i+1]-1;
}
}
return 0;
}
*/
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- 回溯法
- .Net 该如何学习?
- 惊艳的Ubuntu 10.04 Lucid Lynx
- jBPM4.3数据库中表的简单介绍
- 教你玩Robocode(4)——规则系统
- 堆栈及其模拟
- 回溯法
- 转的:FPGA与CPLD的区别
- VS2005默认使用Unicode字符集的问题
- sql语句
- windows live message 无法安装
- VC6.0中OpenGL开发环境配置(整opengl必看)
- 如何检测vc的内存泄漏(Visual Leak Detector)
- java学习之JNI学习二 取得属性和方法的ID
- 通过程序产生click事件,而不用鼠标单击