上一页 1 2 3 4 5 6 ··· 20 下一页
摘要: UVA11400 分析:首先我们需要明白一个问题,就是每种电压的灯泡要么就是全部替换,要么全部不替换,为什么呢?因为如果只替换一半,那两种电源都需要,不划算,从另一个方面来说,既然转化一半会比原来小,那为什么不全部转换呢?接着根据题意我们应该把灯泡按照电压从小到大排序。然后我们令dp[i]表示1~i 阅读全文
posted @ 2017-08-06 21:40 wolf940509 阅读(358) 评论(0) 推荐(0) 编辑
摘要: A题 分析:按题意比较二者之间的大小关系即可 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 using namespace std; 5 int s,v1,v2,t1,t2; 6 int main() 7 { 8 c 阅读全文
posted @ 2017-08-01 16:16 wolf940509 阅读(108) 评论(0) 推荐(0) 编辑
摘要: A题 分析:水题,模拟一下顺时针和逆时针情况就好了 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 #include "vector" 6 using namespace std 阅读全文
posted @ 2017-07-31 10:08 wolf940509 阅读(121) 评论(0) 推荐(0) 编辑
摘要: A题 分析:直接看n/k的奇偶性 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 using namespace std; 5 long long n,k; 6 int main() 7 { 8 cin>>n>>k; 阅读全文
posted @ 2017-07-25 11:14 wolf940509 阅读(126) 评论(0) 推荐(0) 编辑
摘要: A题 分析:遇到1就统计有几个连续的,遇到0若连续的多于一个就输出后面的0 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 #include "vector" 6 using n 阅读全文
posted @ 2017-07-24 20:44 wolf940509 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 每做一次决策就可以得到解的一部分,当所有决策做完以后,完整的解就"浮出水面“。在回溯法中,每次决策对应于给一个结点产生新的子树,而解的生成过程对应一颗解答树,结点的层数就是下一个待填充的位置 UVA116 分析:dp[i][j]记录从(i,j)出发的最小值,本题同时还要求输出字典序最小的解,所以需要 阅读全文
posted @ 2017-07-24 15:36 wolf940509 阅读(375) 评论(0) 推荐(0) 编辑
摘要: Chang and Bitwise OR 分析:因为按位或最后肯定小于等于加,所以把所有数按位或即可 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 using namespace std; 5 const int m 阅读全文
posted @ 2017-07-24 09:29 wolf940509 阅读(130) 评论(0) 推荐(0) 编辑
摘要: UVA1025 分析:因为时间是单向流逝的,是天然的"序",所以影响决策的只有当前时间和所处的决策。dp[i][j],表示在第i分钟时,处于第j个车站,最少还需要多少等待时间,因此其等待时间就有站原地等待,乘坐从左到右的车,乘坐从右到左的车,三个状态来决定。 1 #include "iostream 阅读全文
posted @ 2017-07-23 02:34 wolf940509 阅读(351) 评论(0) 推荐(0) 编辑
摘要: 链接 分析:dp[i][j]表示前i个数能够组成j的对数,可得dp[i][j]=dp[i-1][j]+dp[i-1][j-i],所以最后dp[n][sum/2]既是所求 1 /* 2 PROB:subset 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostr 阅读全文
posted @ 2017-07-17 19:23 wolf940509 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 链接 分析:先打表需要用到的罗马数字,然后暴力转换,最后统计一下即可 1 /* 2 PROB:preface 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" 7 #include "cstdio" 8 #include "cstring" 9 # 阅读全文
posted @ 2017-07-17 13:25 wolf940509 阅读(109) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 20 下一页