customtype.h
来自「vc实现的关于“带锁的门”的求解算法」· C头文件 代码 · 共 31 行
H
31 行
//////////////////////////////////////////////////////////////////////////
//the scale of the problem
//#define N 10;
const int N = 10;
//////////////////////////////////////////////////////////////////////////
//define door state
enum tagDoorState
{
DS_OPEN,
DS_CLOSE
}DoorState;
//////////////////////////////////////////////////////////////////////////
//implement the function
void ChangeDoorState(int door[], int n)
{
// first time open all doors [9/30/2008 wkc]
for (int l = 1; l <= n; l++)
{
door[l - 1] = DS_OPEN;
}
for (int i = 2; i <= n; i++)
{
for (int j = i; j <= n; j *= i)
{
door[j - 1] = (door[j - 1] == DS_CLOSE) ? DS_OPEN : DS_CLOSE;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?