#include using namespace std;int func(int x){ int
cnt = 0; while (x) { cnt++; x = x&(x - 1); } return cnt;}int main(){ ...
分类:
其他好文 时间:
2014-05-17 14:54:19
阅读次数:
194
using System;using System.Collections.Generic;using
System.Linq;using System.Text;namespace 对象引用{ class Program { static void
Main(string...
分类:
其他好文 时间:
2014-05-17 14:30:19
阅读次数:
279
专出神题的xyz。支持删加边、修改点权、维护树的直径。LCT
需要额外记录子树信息。用一个堆维护。#include#include#include#include#include#includeusing
namespace std;#define rep(i,x,y) for(i=x;i=y;i....
分类:
其他好文 时间:
2014-05-17 14:29:38
阅读次数:
667
program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace GroupBoxTest13
{
static class Program
{
///
/// 应用程序的...
分类:
其他好文 时间:
2014-05-16 01:56:45
阅读次数:
319
题目:
链接:点击打开链接
题意:
DFS搜索
算法:
dfs
思路:
简单题
代码:
#include
#include
#include
using namespace std;
int w,h;
char s[30][30];
int vis[30][30];
int cnt;
void dfs(int x,int y)
{
if...
分类:
其他好文 时间:
2014-05-16 00:02:10
阅读次数:
438
题目:
链接:点击打开链接
题意:
输入n和nc,以及字符串s,输出长度为n的不同字串的个数。
算法:
思路:
用hash判重(hash值。。。。。。),看了大牛的代码,对hash还是不甚理解。。。。
代码:#include
#include
#include
#include
using namespace std;
#define MAXN 1...
分类:
其他好文 时间:
2014-05-15 23:25:24
阅读次数:
404
题目:
链接:点击打开链接
题意:
roy抢银行,知道每个银行的存款和被抓的概率,以及Roy能够被抓的概率,求他能够抢劫的最多的money。
思路:
dp[i]表示抢劫i块钱不被抓的概率,当i==0时,一定不会被抓,即dp[0] = 1;
代码:
#include
#include
#include
using namespace std;
#define M...
分类:
其他好文 时间:
2014-05-15 23:05:08
阅读次数:
266
http://acm.hdu.edu.cn/showproblem.php?pid=4811
推理一下,发现可以先求出后面放小球可以加分的最大值,然后前面的和为0 + 1 + 2 + ...+ max,max最大为6,因为每个球最多算左右两边
代码:
#include
#include
using namespace std;
long long a, b, c;
long long ...
分类:
其他好文 时间:
2014-05-15 23:04:28
阅读次数:
387
裸题,瞬秒。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define L(id) tree[id].ch[0]
#define R(id) tree[id].ch[1]
#define Size(id) tree[id].size
#...
分类:
其他好文 时间:
2014-05-15 22:52:51
阅读次数:
328
题目;
点击打开链接
代码;
#include
#include
#include
using namespace std;
struct beibao{
int val;
int vol;
}bag[1010];
int main()
{
int dp[1010];
int i,j,n,v;
int t;
cin>>t;
wh...
分类:
其他好文 时间:
2014-05-15 22:50:51
阅读次数:
394