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 在注册是 可以使用这个优 ...
随机推荐
- Sea.js入门
本文只是seajs的入门贴.要详细了解,请看GitHub主页上的相关链接,精彩不断,精选几篇: 前端模块化开发的价值 前端模块化开发的历史 ID和路径匹配原则 与RequireJS的异同 模块的加载启 ...
- [工作记录] Android OpenSL ES: references & AAC related
AAC V.S. MP3 http://en.wikipedia.org/wiki/Advanced_Audio_Coding#AAC.27s_improvements_over_MP3 AAC pa ...
- Git 局域网简单配置
Git核心:http://code.google.com/p/msysgit/downloads/list?q=full+installer+official+gitTortoiseGit :http ...
- mvc从xheditor编辑器中获取内容时存在潜在危险
xmfdsh在使用xheditor提交要发布的文章等内容的时候出现了如下的错误: 从客户端(Content="<p style="text-align...")中检 ...
- unity资源(移动版)提取 一点尝试
原地址:http://blog.csdn.net/delguoqing/article/details/22619711 最近在参与一款手游,需要制定美术制作规范.因为拿不准主意,所以决定参考其他游戏 ...
- 数据库链接 mysql,sqlserver
1.生成对象工厂 /// <summary> /// 生成对象工厂 /// </summary> public class DBFactory { /// <summar ...
- Win32应用程序中文支持
Settings--Editor---Encoding改为Windows 936 main.cpp中#include "locale.h" winmain中增加一行: setloc ...
- Map中放置类指针并实现调用
工作中使用到多进程通信,利用到了map以及multimap来进行实现. 需要做一个简单测试例子,直接上代码. /* * main.cpp * Created on: Oct 28, 2013 * Au ...
- sessionID的本质
SessionID的本质 一.客户端用cookie保存了sessionID 客户端用cookie保存了sessionID,当我们请求服务器的时候,会把这个sessionID一起发给服务器,服务器会到内 ...
- 线段树(区间合并) POJ 3667 Hotel
题目传送门 /* 题意:输入 1 a:询问是不是有连续长度为a的空房间,有的话住进最左边 输入 2 a b:将[a,a+b-1]的房间清空 线段树(区间合并):lsum[]统计从左端点起最长连续空房间 ...