摘要: 7.29 黄昏时刻(一) 全排列建模: 给了数字n 代表从1-n 个数全排列思路: 1. 输入n,如果n值为‘0’,则退出程序 2. vis[i] 保存 是否对第i个数字进行访问 3. dfs 遍历1-n 个数字的全排列,若重复访问,则越过。直到最终访问结束输出访问的的结果。之后回溯删掉对数字的访问。优化: none代码: 1 #include 2 #include 3 4 int a[20] ,n, vis[20]; 5 6 void dfs(int s) { 7 int i; 8 //如果dfs 次数为n,则输出a数组的内容 9 if(s... 阅读全文
posted @ 2013-07-29 15:57 Levi.duan 阅读(263) 评论(0) 推荐(0) 编辑
摘要: Judge InfoMemory Limit: 65536KBCase Time Limit: 3000MSTime Limit: 3000MSJudger: Number Only JudgerDescriptionWithin Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness.You are employed by 阅读全文
posted @ 2013-07-29 15:09 Levi.duan 阅读(299) 评论(0) 推荐(0) 编辑