You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
2.2 KiB
133 lines
2.2 KiB
#define _CRT_SECURE_NO_DEPRECATE
|
|
#include<stdio.h>
|
|
#include<string.h>
|
|
#include<stdlib.h>
|
|
#include<conio.h>
|
|
int denglu(char x[])
|
|
{
|
|
if (strcmp(x,"677abc!")==0)return 1;
|
|
else return -1;
|
|
}
|
|
int n = 0;
|
|
int rest[7][7];
|
|
int swap(int *a, int *b)
|
|
{
|
|
int m;
|
|
m = *a;
|
|
*a = *b;
|
|
*b = m;
|
|
return 0;
|
|
}
|
|
void perm(int list[], int k, int m)
|
|
{
|
|
int i, j;
|
|
if (k > m)
|
|
{
|
|
for (i = 0; i < 7; i++)
|
|
{
|
|
for (j = 0; j < 7; j++)
|
|
{
|
|
if (rest[i][j] == -1)
|
|
return;
|
|
if (rest[i][j] != list[i])
|
|
continue;
|
|
if (rest[i][j] == list[i])
|
|
break;
|
|
}
|
|
}
|
|
n++;
|
|
printf("方案:%d\n", n);
|
|
printf("赵 钱 孙 李 周 吴 陈\n");
|
|
printf("---------------------------------------------------------\n");
|
|
for (i = 0; i <= m; i++)
|
|
{
|
|
switch (list[i])
|
|
{
|
|
case 1:printf("星期一 ");
|
|
break;
|
|
case 2:printf("星期二 ");
|
|
break;
|
|
case 3:printf("星期三 ");
|
|
break;
|
|
case 4:printf("星期四 ");
|
|
break;
|
|
case 5:printf("星期五 ");
|
|
break;
|
|
case 6:printf("星期六 ");
|
|
break;
|
|
case 7:printf("星期天 ");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
printf("\n\n\n");
|
|
}
|
|
else
|
|
{
|
|
for (i = k; i <= m; i++)
|
|
{
|
|
swap(&list[k], &list[i]);
|
|
perm(list, k + 1, m);
|
|
swap(&list[k], &list[i]);
|
|
}
|
|
}
|
|
}
|
|
int main()
|
|
{
|
|
char h[10];
|
|
int tt = 0;
|
|
printf("----------------------登录界面----------------------\n");
|
|
printf("*********************请输入密码*********************\n\n");
|
|
do
|
|
{
|
|
h[tt]=getch();
|
|
if (h[tt] == '\b')
|
|
{
|
|
printf("\b \b");
|
|
tt--;
|
|
}
|
|
else if (h[tt] == '\r')
|
|
{
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
tt++;
|
|
printf("*");
|
|
}
|
|
}
|
|
while (h[tt] != '\r'&&tt<10);
|
|
h[tt] = 0;
|
|
tt = denglu(h);
|
|
if (tt != 1)
|
|
{
|
|
printf("\n 您输入的密码有误!\n");
|
|
return 0;
|
|
}
|
|
else printf("\n\n\n");
|
|
|
|
int list[] = { 1, 2, 3, 4, 5, 6, 7 };
|
|
int i, j;
|
|
char ss[7][20] = { "赵", "钱", "孙", "李", "周", "吴", "陈" };
|
|
printf("==================欢迎使用排版系统==================\n");
|
|
printf(" 请输入下列人选选择休息的可能时间:\n");
|
|
for (i = 0; i < 7; i++)
|
|
{
|
|
printf("%s:", ss[i]);
|
|
for (j = 0; j < 7; j++)
|
|
{
|
|
scanf("%d", &rest[i][j]);
|
|
if (rest[i][j] == -1)
|
|
break;
|
|
}
|
|
}
|
|
printf("\n\n\n");
|
|
perm(list, 0, 6);
|
|
printf("总共有%d种\n", n);
|
|
getchar();
|
|
getchar();
|
|
return 0;
|
|
}
|
|
|