这里基本就是入门吧。

可达性统计 用bitset搞的判重,发现这东西是真好用哈,空间还小

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<map>
#include<bitset>
using namespace std; map<int,bool>mp[];
struct node
{
int x,y,next;
}a[];int len,last[];
void ins(int x,int y)
{
len++;
a[len].x=x;a[len].y=y;
a[len].next=last[x];last[x]=len;
} int top,sta[];
int ru[];
bitset<>s[];
int main()
{
int n,m;
scanf("%d%d",&n,&m);
len=;memset(last,,sizeof(last));
memset(ru,,sizeof(ru));
for(int i=;i<=m;i++)
{
int x,y;
scanf("%d%d",&x,&y);
if(mp[x][y]==false)
{
ins(y,x);ru[x]++;
mp[x][y]=true;
}
} top=;
for(int i=;i<=n;i++)
{
if(ru[i]==)sta[++top]=i;
s[i][i]=;
}
while(top!=)
{
int x=sta[top];top--;
for(int k=last[x];k;k=a[k].next)
{
int y=a[k].y;
ru[y]--;s[y]|=s[x];
if(ru[y]==)
sta[++top]=y;
}
}
for(int i=;i<=n;i++)printf("%d\n",s[i].count());
return ;
}

可达性统计

小猫爬山 就冲着Freda和rainbow这口狗粮随便写了。

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<map>
#include<bitset>
using namespace std; int n,W,mmin;
int c[],d[];
void dfs(int k,int sp)
{
if(sp>=mmin)return ;
if(k==n+)
{
mmin=sp;
return ;
}
for(int i=;i<=sp;i++)
if(d[i]+c[k]<=W)
{
d[i]+=c[k];
dfs(k+,sp);
d[i]-=c[k];
}
d[sp+]=c[k];
dfs(k+,sp+);
}
int main()
{
scanf("%d%d",&n,&W);
for(int i=;i<=n;i++)scanf("%d",&c[i]);
d[]=;mmin=n;dfs(,);
printf("%d\n",mmin);
return ;
}

小猫爬山

数独那题不大想做啊。

0x20 搜索的更多相关文章

  1. Centos6 yum安装openldap+phpldapadmin+TLS+双主配置

    原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ...

  2. openldap+phpadmin的搭建安装

    1.概念介绍 LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以根据 ...

  3. OpenLDAP介绍和安装

    LADP 1.目录服务 目录是一个为查询.浏览和搜索而优化的专业分布式数据库,它呈树状结构组织数据,就好象Linux/Unix系统中的文件目录一样.目录数据库和关系数据库不同,它有优异的读性能,但写性 ...

  4. 制作chm无搜索标签解决方法

    chm无搜索标签解决方法: 1.hpp文件中设置Full-text search=Yes 2.下面[windows]有个数字设置为0x420, 网上普通流传的是0x20 === chm制作一般要三个文 ...

  5. 如何使用python来模拟鼠标点击(将通过实例自动化模拟在360浏览器中自动搜索"python")

    一.准备工作: 安装pywin32,后面开发需要pywin32的支持,否则无法完成与windows层面相关的操作. pywin32的具体安装及注意事项: 1.整体开发环境: 基于windows7操作系 ...

  6. grep精确匹配搜索某个单词的用法 (附: grep高效用法小结))

    grep(global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正 ...

  7. hash算法搜索获得api函数地址的实现,"kernel32.dll", "CreateThread"

    我们一般要获得一个函数的地址,通常采用的是明文,例如定义一个api函数字符串"MessageBoxA",然后在GetProcAddress函数中一个字节一个字节进行比较.这样弊端很 ...

  8. IDA断点和搜索

    一.断点 调试很重要一点是下断点,看看IDA提供的功能,本来已经和WinDbg一样强了. 官方文档的变化 Edit breakpoint Action name: BreakpointEdit Con ...

  9. SQLSERVER走起微信公众帐号已经开通搜狗微信搜索

    SQLSERVER走起微信公众帐号已经开通搜狗微信搜索 请打开下面链接 http://weixin.sogou.com/gzh?openid=oIWsFt-hiIb_oYqQHaBMoNwRB2wM ...

随机推荐

  1. 从有约束条件下的凸优化角度思考神经网络训练过程中的L2正则化

    从有约束条件下的凸优化角度思考神经网络训练过程中的L2正则化 神经网络在训练过程中,为应对过拟合问题,可以采用正则化方法(regularization),一种常用的正则化方法是L2正则化. 神经网络中 ...

  2. golang二维码

    package main import ( "github.com/boombuler/barcode" "github.com/boombuler/barcode/qr ...

  3. CaptCha的现状与未来

    2011年的老文.................转自于伯乐在线:http://blog.jobbole.com/4655/       有一个机会,朋友推荐一个创业的哥们给我认识,方向就是验证码识别 ...

  4. ObjecT4:On-line multiple instance learning (MIL)学习

    原文链接:http://blog.csdn.net/ikerpeng/article/details/19235391 用到论文,直接看翻译. 文章:Robust object tracking wi ...

  5. 创建一个dynamics CRM workflow (五) - Deploy Custom Workflows

    我们打开plugin registeration tool. 注册一个新的assembly. custom workflow 和 plugin注册的方法还有些不同. 这一步custom workflo ...

  6. switch 语句来选择要执行的多个代码块之一。

    switch(n) { case 1: 执行代码块 1 break; case 2: 执行代码块 2 break; default: n 与 case 1 和 case 2 不同时执行的代码 }

  7. jQuery中Ajax的几种写法

    1.   $.post(url,params,callback); 采用post方式提交,中文参数无需转码,在callback中如果要获取json字符串,还需转换一下. 2.  $.getJSON(u ...

  8. CentOS 7添加开机启动服务/脚本

    一.添加开机自启服务 在CentOS 7中添加开机自启服务非常方便,只需要两条命令(以 jenkins 为例):systemctl enable jenkins.service #设置jenkins服 ...

  9. HAOI2006 受欢迎的牛 缩点

    不难分析出我们就是要求是否有唯一一个出度为0的强连通分量. Code: #include<cstdio> #include<stack> #include<algorit ...

  10. mysql8下载与安装

    MySQL各版本的区别 MySQL 8.0.13安装教程(windows 64位)   编码用utf8mb4 Navicat连接mysql出现1862错误