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

📄 mymath.c

📁 是C++的基础
💻 C
字号:
#include "MyMath.h"
#include "MyAssert.h"
#include "Ulti.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
/*Attention when n is big ,this algorithm will have no little effect*/
long combination(int n,int m)/*output the group num from select from n element*/
{
	/*Algorithm Reason
	Cm,n=n!/(m!*(n-m)!)
	*/
	assertF(n>=m&&n<17,"in combination n<m or n is too big\n");
	if(n==m||m==0)return 1;
	else return jieCheng(n)/(jieCheng(m)*jieCheng(n-m));/**/
}

long jieCheng(int n)
{
	assertF(n>=0&&n<17,"in jieCheng n is<0 or n is too big!\n");
	if(n==1||n==0)return 1;
	else return n*jieCheng(n-1);
}

⌨️ 快捷键说明

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