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 在注册是 可以使用这个优 ...
随机推荐
- sprytabbedpanels.js库之在页面中插入Tabbed Panels
向页面加入sprytabbedpanels.js文件.<script src="SpryAssets/SpryTabbedPanels.js" type="text ...
- Codeforces Round #243 (Div. 1) A题
http://codeforces.com/contest/425/problem/A 题目链接: 然后拿出这道题目是很多人不会分析题目,被题目吓坏了,其中包括我自己,想出复杂度,一下就出了啊!真是弱 ...
- Asp.net的服务器推技术 (Server Push)
在以往的和服务器端通信技术中,我们多数使用的是AJAX轮询式访问,也就是在Javascript中控制时间间隔,然后每隔一段时间就访问一次服务器,然后获得数据或通知.但是这种轮询方式的访问有90%是在做 ...
- MySQL各个版本区别
MySQL 的官网下载地址:http://www.mysql.com/downloads/ 在这个下载界面会有几个版本的选择. 1. MySQL Community Server 社区版本,开源免费, ...
- HDU 1028 Ignatius and the Princess III (递归,dp)
以下引用部分全都来自:http://blog.csdn.net/ice_crazy/article/details/7478802 Ice—Crazy的专栏 分析: HDU 1028 摘: 本题的意 ...
- JavaWeb开发好资料
以下来源:http://oss.org.cn/ossdocs/ Documents 操作系统: GNU, Linux, Linux核心, Linux Kernel API, Linux核心架构: a1 ...
- ExtJs之文本框及数字输入
结合HTML来理解, 比较容易. <!DOCTYPE html> <html> <head> <title>ExtJs</title> &l ...
- 传说中的WCF(11):会话(Session)
在标题中我加了一个大家都很熟悉的单词——Session,熟吧?玩过Web开发的朋友肯定在梦中都会见到她. 在Web中为什么要会话呢?毕竟每个用户在一个Web应用中可能不止进行一次操作,比如,某二手飞机 ...
- cache写策略
cache写策略 Write Through (完全写入) CPU向cache写入数据时,同时向memory也写一份,使cache和memory的数据保持一致.优点是简单,缺点是每次都要访问memor ...
- grep是模糊匹配
1. 我:我用的ps -nat|grep -i "80"|wc -l命令 我:解释详细点,,龙哥,对于我这种菜鸟:也是模糊匹配 :你用 grep "80" 会匹 ...