#1289 : 403 Forbidden 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi runs a web server. Sometimes he has to deny access from a certain set of malicious IP addresses while his friends are still allow to access his server. To do this he writes N rule…
传送门 #1289 : 403 Forbidden 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi runs a web server. Sometimes he has to deny access from a certain set of malicious IP addresses while his friends are still allow to access his server. To do this he writes N…
http://hihocoder.com/problemset/problem/1289 这题是这次微软笔试的第二题,过的人比第三题少一点,这题一眼看过去就是字符串匹配问题,应该可以使用字典树解决.不过当时还有一个想法就是离线处理,把所有查询进行排序,然后用rule去匹配查询,进行染色处理,而且每个查询只进行一次染色.事实证明,如果比赛的时候采用第二种方法应该能拿全分,但是我用了第一种方法,导致只拿了10分...因为我没有考虑同一个rule出现两次的情况,但是字典树中会直接被后面的rule覆盖,…
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描写叙述 Little Hi runs a web server. Sometimes he has to deny access from a certain set of malicious IP addresses while his friends are still allow to access his server. To do this he writes N rules in the configurati…
#1290 : Demo Day 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 You work as an intern at a robotics startup. Today is your company's demo day. During the demo your company's robot will be put in a maze and without any information about the maze, it should be…
金色十月线上编程比赛第二题:解密 题目详情: 小强是一名学生, 同一时候他也是一个黑客. 考试结束后不久.他吃惊的发现自己的高等数学科目竟然挂了,于是他果断入侵了学校教务部站点. 在入侵的过程中.他发现了与成绩相关的内容是一个加密文件,这个文件由 n 个数构成,经过分析.这个加密文件的密钥为这 n 个数中二进制位数 1 最少的数. 但因为数比較多,小强 希望你能帮他得到密钥,好在成绩发布之前将成绩改过来. 输入描写叙述: 输入由多组数据构成.每组数据第一行为一个数 n(1<=n<=10^5),…
[题目链接]:http://hihocoder.com/problemset/problem/1498 [题意] 一开始你有1个机器人; 你有n个工作; 每个工作都需要一个机器人花1小时完成; 然后每个机器人能够花Q时间建造另外一个机器人; ->有两个机器人了! 可以无限建造; 然后问你工作完成需要多长时间. [题解] 贪心题; 这题直接枚举建了次的机器人; 建的时候; 之前所有建的机器人都在建; 也就是说在建新的机器人的时候; 没有其他机器人是在工作的; 贪心的道理就是; 新建机器人,比直接让…
[题目链接]:http://hihocoder.com/problemset/problem/1497 [题意] 给你n个皇后; 然后问你其中能够互相攻击到的皇后的对数; 皇后的攻击可以穿透; [题解] 对角线的话 就把x+y和x-y占据; 然后把x行和y列占据了; 每次对输入的数据看看对角线和行和列有没有棋子; 有的话就加上相应的数目; 这个用map就能搞定; 可能会爆int [Number Of WA] 0 [完整代码] #include <bits/stdc++.h> using nam…
#!/usr/bin/env python # coding:utf-8 # Queen Attack # https://hihocoder.com/problemset/problem/1497 # Author: kngxscn # Date: 2017-04-22 """ 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 There are N queens in an infinite chessboard. We say two que…
描述 You are given a sequence S of parentheses. You are asked to insert into S as few parentheses as possible so that the resulting sequence T is well matched. It's not difficult. But can you tell how many different T you can get? Assume S = ()), you c…