摘要: 题意: 知道了连续的 n 个数的 值,有两种操作: 1 a b kc: adding c to each of Ai which satisfies a <= i <= b and (i - a) % k == 0 2 a :means querying the value of a分析:因为k比价小,可以多个树状数组,根据 i%k的不同建立k 个树状数组,每次修改操作对其中 1 棵树状数组进行操作 每次查询对其中10个树状数组统计结果累加。#include<stdio.h>#include<string.h>#define clr(x)memset(x,0 阅读全文
posted @ 2012-09-10 21:26 'wind 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题意: 有N 个点的无向图,要去其中 h个地点做事,做事需要先办理护照,之后可以挣一定数量的钱,知道了一开始有的总钱数,和 一些城市之间道路的花费,问可不可以在 指定的 h 个城市打完工,并回到起点 1.分析: 状态DP,直接枚举所有可能状态即可。#include<stdio.h>#include<string.h>#define max(a,b)(a)>(b)?(a):(b)#define INF 0x3f3f3f3fint g[155][155];int dp[1<<16][16];int num[22];int earn[22];int cost 阅读全文
posted @ 2012-09-10 19:00 'wind 阅读(593) 评论(0) 推荐(0) 编辑