分书问题
来源:互联网 发布:淘宝一千零一夜第二季 编辑:程序博客网 时间:2024/05/16 15:19
#include <stdio.h>const int like[5][5] = { {0, 0, 1, 1, 0}, {1, 1, 0, 0, 1}, {0, 1, 1, 0, 1}, {0, 0, 0, 1, 0}, {0, 1, 0, 0, 1}};int take[5], book[5] = {0, 0, 0, 0, 0};void _try(int i) { static int n = 0; int j, k; for (j = 0; j <= 4; j++) { if (like[i][j] > 0 && book[j] == 0) { take[i] = j; book[j] = 1; if (i == 4) { n++; printf("No.%d scheme\n", n); for (k = 0; k <= 4; k++) printf("book %d is given to %c\n", take[k], (char)k + 'A'); putchar('\n'); } else { _try(i + 1); } book[j] = 0; } }}int main() { _try(0); return 0;}
0 0
- 分书问题
- 分书问题
- 分书问题
- 分书问题
- 分书问题
- 分书问题 559NEFUOJ
- NEFU559 分书问题【递归】
- 分书问题(递归)
- 分书问题,递归调用
- 分书问题(搜索)
- 分书问题 暴力求解
- 分书和八皇后问题
- nefu559分书问题【类8皇后】
- nefu 分书问题 559 (递归)
- 分书问题(搜索)nefu559
- AOJ.863 分书问题 (DFS)
- 海盗分金块问题
- 水手分椰子问题
- 高等几何——周兴和答案2(自己写的,非标准答案,望指正)
- HDU1247--Hat’s Words【STL--map】
- UVa1596 - Bug Hunt
- leetcode Divide Two Integers
- cookie、session、sessionid 与jsessionid
- 分书问题
- uva 10057 A mid-summer night’s dream(中位数)
- Android之fragment介绍及fragment详解
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxError Exception
- 解决android开发中eclipse不能自动提示
- 用jquery解析JSON数据的方法
- Unity技巧集合
- android:AndroidAnnotations上传文件,网络接口如此简洁
- “is not a core dump: File format not recognized”错误解决