Btnadd事件:
string r = " ";
int txt1 = Convert.ToInt32(sp_one.Text.Trim());
int txt2 = Convert.ToInt32(sp_two.Text.Trim());
faf(txt1, txt2, r);
faf函数:
public void faf(int t1, int t2, string rs)
{
string xixi=string.Empty;
for (int j = t1; j >= 1; j--)
{
int t_1 = j - 1;
int t_2 = t2 - j;
if (t_2 == 0)
{
xixi += j + " " + rs + "<br>";
}
if ((1 + t_1) * t_1 > t_2 * 2)
{
string r_s = j + " " + rs;
faf(t_1, t_2, r_s);
}
}
a.Text = a.Text + xixi;
}
我恨我没学好高等数学和离散数学 写不出好的算法-------哎