摘要: 链接以前做的题 VJ太水了 数组里面的数可能会小于0 当时没判断 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dp[100010],w[110],path[110],o,f[110],n,ff[110]; 8 int flag,tw; 9 void dfs(int sw,int v,int u)10 {11 int j,i;12 if(flag) return ;13 path[v] = u;14 if(sw==0)15 {16 ... 阅读全文
posted @ 2013-09-10 11:45 _雨 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 链接这题卡了挺久了 昨天试着用类似dfs的方法直接TLE在第二组 看了下题解,,发现s1,s2的范围是个幌子。。100位最大的s1900 s28100 觉得s1s2太大不敢开二维。。这样就简单了 类似背包 dp[s1][s2]表示组成s2s2最少的位数 其实就是装进去多少个数字 正好把s1s2装满把DP部分预处理之后放在外面 不然会超时 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 0xfffffff 8 int s1,s2; 9 int dp[920][. 阅读全文
posted @ 2013-09-10 09:43 _雨 阅读(236) 评论(0) 推荐(0) 编辑