hdu4760Good Firewall
数组模拟就可以了 读的时候可以整数读入
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<cmath>
#include<vector>
using namespace std;
#define LL __int64
int len,maxz;
LL ip[][][],pp[];
int vis[],w[],di[],g;
char s[],s1[],s2[];
void init()
{
int i;
pp[] = ;
for(i = ; i < ; i++)
pp[i] = pp[i-]*;
}
void change(int a)
{
int x[],o=,i;
while(a)
{
x[++o] = a%;
a/=;
}
for(i = ; i <= -o ; i++)
di[++g] = ;
for(i = o ; i>= ; i--)
di[++g] = x[i];
}
LL swit(int k,int e)
{
int i;
LL sum=;
if(k==)
for(i = ; i <= g ; i++)
sum+=di[i]*pp[-i];
else
{
for(i = ; i <= e ; i++)
sum+=di[i]*pp[-i];
for(i = e+ ; i <= ; i++)
sum+=pp[-i];
}
return sum;
}
int main()
{
int m,n,i,j;init();
int a,b,c,d,e;
char cc;
while(scanf("%c",&cc)!=EOF)
{
if(cc=='E')
{
scanf("%d%d",&n,&m);
w[n] = m;
maxz = max(maxz,n);
for(i = ; i <= m ;i++)
{
getchar();
scanf("%d.%d.%d.%d/%d",&a,&b,&c,&d,&e);
g=;
change(a);change(b);change(c);change(d);
ip[n][i][] = swit(,);
ip[n][i][] = swit(,e);
}
}
else if(cc=='F')
{
scanf("%d.%d.%d.%d",&a,&b,&c,&d);
g=;
change(a);change(b);change(c);change(d);
LL fs1 = swit(,);
scanf("%d.%d.%d.%d",&a,&b,&c,&d);
g=;
change(a);change(b);change(c);change(d);
LL fs2 = swit(,);
int flag = ;
for(i = ; i <= maxz ; i++)
{
int f=,ff=;
if(vis[i]) continue;
for(j = ; j <= w[i] ; j++)
{
if(fs1>=ip[i][j][]&&fs1<=ip[i][j][])
f = ;
if(fs2>=ip[i][j][]&&fs2<=ip[i][j][])
ff = ;
}
if(ff&&f)
{
flag = ;
break;
}
}
if(flag)
printf("F\n");
else
printf("D\n");
}
else
{
scanf("%d",&n);
vis[n] = ;
}
gets(s);
}
return ;
}
hdu4760Good Firewall的更多相关文章
- Linux学习之八--关闭firewall防火墙安装iptables并配置
CentOS 7之后默认使用的是firewall作为防火墙,这里改为iptables防火墙,并开启80端口.3306端口. 1.关闭firewall: systemctl stop firewalld ...
- Neutron 理解 (9): OpenStack 是如何实现 Neutron 网络 和 Nova虚机 防火墙的 [How Nova Implements Security Group and How Neutron Implements Virtual Firewall]
学习 Neutron 系列文章: (1)Neutron 所实现的虚拟化网络 (2)Neutron OpenvSwitch + VLAN 虚拟网络 (3)Neutron OpenvSwitch + GR ...
- centos7 firewall 防火墙
在部署dubbo-monitor 和dubbo-admin zookeeper时候,外部访问不了部署好的服务,因为端口问题 ,现在把端口操作总结一下 参考: http://www.cnblogs.co ...
- WAF(Web Appliction Firewall) Bypass Technology Research
catalog . What is Firewall . Detecting the WAF . Different Types of Encoding Bypass . Bypass本质 1. Wh ...
- ModSecurity web application firewall (WAF) Research
catalog . 引言 . OWASP ModSecurity Core Rule Set (CRS) Project . Installation mod_security for Apache ...
- centos7 关闭firewall安装iptables并配置
一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...
- CentOS7下Firewall防火墙配置用法详解
官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...
- Good Firewall(字典树 HDU4760)
Good Firewall Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- centos7 firewall 防火墙 命令
为了架设ss在vultr上买了一个日本的vps 用的是centos7的系统 防火墙是 firewall 捣鼓了两天 在这里总结一下. 如果小伙伴也准备在vultr上买vps 在注册是 可以使用这个优 ...
随机推荐
- CSS中常用的字体单位:px、em、rem和%的区别
在刚接触CSS时,px用的比较多,也很好理解,可是用久了就会发现有些缺陷,特别是在做响应式开发的时候. 那这么多单位到底在什么时候用什么单位合适呢?今天就来探讨一下. 先大致解释一下这些单位的意思: ...
- zero to one:创业秘籍并不存在,因为任何创新都是新颖独特的,任何权威都不可能具体规定如何创新
彼得·蒂尔(Peter Thiel)的新作<从0到1>从预售开始就占据美国亚马逊排行榜第一名的位置,被一批创业家和企业家评为“迄今为止最好的商业书”.这是一本关于如何创建创新公司的书,主要 ...
- Sqli-labs less 63
Less-63 和less62一致,我们只需要看到sql语句上 $sql="SELECT * FROM security.users WHERE id='$id' LIMIT 0,1&quo ...
- MariaDB Galera Cluster 部署
原文 http://code.oneapm.com/database/2015/07/02/mariadb-galera-cluster/MariaDB作为Mysql的一个分支,在开源项目中已经广泛 ...
- 【译】 沙箱中的间谍 - 可行的 JavaScript 高速缓存区攻击
王龑 - MAY 27, 2015 原文连接 The Spy in the Sandbox – Practical Cache Attacks in Javascript 相关论文可在 https:/ ...
- HDU 3833 YY's new problem(换种思路的模拟,防超时)
题目链接 用p[a]保存的是输入的a在第p[a]个, 然后根据差值查找. #include<stdio.h> #include<string.h> int main() { ...
- HDU 3255 Farming (线段树+扫面线,求体积并)
题意:在一块地上种蔬菜,每种蔬菜有个价值.对于同一块地蔬菜价值高的一定是最后存活,求最后的蔬菜总值. 思路:将蔬菜的价值看做高度的话,题目就转化成求体积并,这样就容易了. 与HDU 3642 Get ...
- 真机模拟器.a文件编译报错
- Javascript实现 图片的无缝滚动
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- 请问view controller scene,该如何删除
当要删除默认的view controller scene的时候,选中,按del键 注意点击中间的那个左侧按钮,打开scene列表,再选中scene,按del即可删除