上一页 1 2 3 4 5 6 ··· 25 下一页

2014年8月7日

codeforces 401D (数位DP)

摘要: 思路:很明显的数位dp,设dp[i][j] 表示选取数字的状态为i,模m等于j的数的个数,那么最后的答案就是dp[(1#include#include#include#include#define LL long longusing namespace std;const int MAXN = 18... 阅读全文

posted @ 2014-08-07 21:14 ~Love() 阅读(238) 评论(0) 推荐(1)

2014 多校联合训练赛6 Fighting the Landlords

摘要: 本场比赛的三个水题之一,题意是两个玩家每人都持有一手牌,问第一个玩家是否有一种出牌方法使得在第一回和对方无牌可出。直接模拟即可,注意一次出完的情况,一开始没主意,wa了一发。#include#include#include#include#includeusing namespace std;cha... 阅读全文

posted @ 2014-08-07 17:41 ~Love() 阅读(149) 评论(0) 推荐(0)

lightoj 1224

摘要: 很简单的Trie树,记录每个前缀的次数,dfs一次Trie即可#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includ... 阅读全文

posted @ 2014-08-07 00:04 ~Love() 阅读(124) 评论(0) 推荐(0)

2014年8月6日

lightoj 1020 (博弈)

摘要: 思路:很简单的博弈,找出每个人先拿的必胜态进行状态转移即可。#include#include#include#include#includeusing namespace std;int main(){ int t, n, CASE(0); char str[10]; scanf... 阅读全文

posted @ 2014-08-06 23:59 ~Love() 阅读(127) 评论(0) 推荐(0)

lightoj 1019

摘要: 裸的最短路 dijkstra#include#include#include#includeusing namespace std;const int MAXN = 101;const int INF = 0x3f3f3f3f;int dist[MAXN], vis[MAXN], mat[MAXN]... 阅读全文

posted @ 2014-08-06 23:59 ~Love() 阅读(212) 评论(0) 推荐(0)

lightoj 1018 (状态压缩DP)

摘要: 设dp[s]表示状态s下所需要的线段的个数,s的二进制中第x位为1就表示该状态下第x个点没被线段覆盖。需要预处理出来在任意两点之间连线所覆盖点的状态O(n^3),然后记忆化搜索即可。#include#include#include#include#includeusing namespace std... 阅读全文

posted @ 2014-08-06 23:52 ~Love() 阅读(174) 评论(0) 推荐(0)

lightoj 1017

摘要: 思路:动态规划,设dp[i][j]表示在前j个dusts中用了i刷子刷掉dusts的个数:状态转移方程就是:dp[i][j] = max(dp[i][j-1], dp[i-1][j-len[j]] + len[j]); len[j]表示刷第j个dust时需要覆盖其前面dusts的个数,可以在O(n... 阅读全文

posted @ 2014-08-06 23:48 ~Love() 阅读(186) 评论(0) 推荐(0)

lightoj 1016

摘要: 水题,排个序直接搞。#include#include#include#include#includeusing namespace std;const int MAXN = 50010;int y[MAXN];int main(){ int t, x, n, w, CASE(0); sc... 阅读全文

posted @ 2014-08-06 23:46 ~Love() 阅读(138) 评论(0) 推荐(0)

lightoj 1015

摘要: 水题,统计大于0的和。#includeint main(){ int t, n, tmp; scanf("%d", &t); for(int i = 1;i 0 ? tmp : 0; } printf("Case %d: %d\n", i, sum);... 阅读全文

posted @ 2014-08-06 23:44 ~Love() 阅读(165) 评论(0) 推荐(0)

lightoj 1014

摘要: 判断到根号n即可,另外使用dfs输出,不需要另开数组再排序。#include#includeint P, L, len, cnt;void dfs(int dep){ if(dep > len) return; if(dep > L){ if(P % dep == 0){ if(... 阅读全文

posted @ 2014-08-06 23:39 ~Love() 阅读(121) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 25 下一页

导航