摘要:
思路:很简单的博弈,找出每个人先拿的必胜态进行状态转移即可。#include#include#include#include#includeusing namespace std;int main(){ int t, n, CASE(0); char str[10]; scanf...
阅读全文
posted @ 2014-08-06 23:59
wangzhili
阅读(130)
推荐(0)
编辑
摘要:
裸的最短路 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
wangzhili
阅读(108)
推荐(0)
编辑
摘要:
设dp[s]表示状态s下所需要的线段的个数,s的二进制中第x位为1就表示该状态下第x个点没被线段覆盖。需要预处理出来在任意两点之间连线所覆盖点的状态O(n^3),然后记忆化搜索即可。#include#include#include#include#includeusing namespace std...
阅读全文
posted @ 2014-08-06 23:52
wangzhili
阅读(185)
推荐(0)
编辑
摘要:
思路:动态规划,设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
wangzhili
阅读(108)
推荐(0)
编辑
摘要:
水题,排个序直接搞。#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
wangzhili
阅读(142)
推荐(0)
编辑
摘要:
水题,统计大于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
wangzhili
阅读(160)
推荐(0)
编辑
摘要:
判断到根号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
wangzhili
阅读(113)
推荐(0)
编辑