2013年4月24日

UESTC OJ 1824 Judgment Day 递归搜索

摘要: 这题就是写个DFS,搞定,比赛的时候没有看到N<=10,不敢暴力,因为这个的复杂度为2^n.看题一定要认真啊啊啊啊!!!!!枚举所有的可能,每个人都有两种情况,一是spell他的名字,一个是不spell.所以一共有2^n种情况,当然,名字拼不出来就只有一种,就是不spell.简单吧,用递归写,我一般都把递归写的叫DFS。贴代码:View Code 1 #include <cstdio> 2 #include <cstring> 3 int n; 4 int num[30]; 5 int pn[11][30]; 6 int max; 7 void dfs(int x 阅读全文

posted @ 2013-04-24 21:25 allh123 阅读(294) 评论(0) 推荐(1) 编辑

导航