Harvesting the Low-hanging Fruits: Defending Against Automated Large-Scale Cyber-Intrusions by Focus


Advanced Fruits


The company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method doesn't work, but sometimes, in very rare cases, a new fruit emerges that tastes like a mixture between both of them.nA big topic of discussion inside the company is "How should the new creations be called?" A mixture between an apple and a pear could be called an apple-pear, of course, but this doesn't sound very interesting. The boss finally decides to use the shortest string that contains both names of the original fruits as sub-strings as the new name. For instance, "applear" contains "apple" and "pear" (APPLEar and apPlEAR), and there is no shorter string that has the same property. nnA combination of a cranberry and a boysenberry would therefore be called a "boysecranberry" or a "craboysenberry", for example.nnYour job is to write a program that computes such a shortest name for a combination of two given fruits. Your algorithm should be efficient, otherwise it is unlikely that it will execute in the alloted time for long fruit names.nnnInputnnEach line of the input contains two strings that represent the names of the fruits that should be combined. All names have a maximum length of 100 and only consist of alphabetic characters.nnInput is terminated by end of file.nnnOutputnnFor each test case, output the shortest name of the resulting fruit on one line. If more than one shortest name is possible, any one is acceptable.nnnSample Inputnnapple peachnananas banananpear peachnnnSample Outputnnappleachnbananasnpearchn 问答

Against Mammoths


Problem DescriptionnBack to year 3024, humans finally developed a new technology that enables them to conquer the alien races. The new technology made it possible to produce huge spaceships known as Saber Tooth spaceships as powerful as the aliens' defending mammoths. At that time, humans ruled several planets while some others were under control of the aliens. Using Saber Tooth ships, humans finally defeated aliens and this became the first Planet War in history. Our goal is to run a simulation of the ancient war to verify some historical hypotheses. nnProducing each spaceship takes an amount of time which is constant for each planet but may vary among different planets. We call the number of spaceships each planet can produce in a year, the production rate of that planet. Note that each planet has a number of spaceships in it initially (before the simulation starts). The planets start producing ships when the simulation starts, so if a planet has nships initially, and has the production rate p, it will have n + p ships at the beginning of year 1, and n + i × p ships at the beginning of year i (years are started from zero).nnBradley Bennett, the commander in chief of the human armies, decided a strategy for the war. For each alien planet A, he chooses a corresponding human planet P, and produces spaceships in P until a certain moment at which he sends all spaceships in P to invade the planet A. No alien planet is invaded by two human planets and no human planet sends its spaceships to two different alien planets. nnThe defense power of the alien planets comes from their powerful mammoths. Each alien planet contains a number of mammoths initially and produces a number of mammoths each year (called the production rate of the planet). When a fight between spaceships and mammoths takes place, the side having the greater number of troops is the winner. If the spaceships win, the alien planet is defeated. In case the number of mammoths and spaceships are equal, the spaceships win.nnThe difficulty with planning this strategy is that it takes some time for the spaceships to reach the alien planets, and during this time, the aliens produce mammoths. The time required for spaceships to travel from each human planet to each alien planet is known. The ships can leave their planets only at the beginning of years (right after the ships are produced) and reach the alien planets at the beginning of years too (right after the mammoths are produced). nnAs an example, consider a human planet with two initial spaceships and production rate three invading an alien planet with two initial mammoths and production rate two. The time required to travel between the two planets is two years and the ships are ordered to leave at year one. In this case, five ships leave the human planet. When they reach the alien planet, they confront eight mammoths and will be defeated during the fight.nnBennett decided to prepare a plan that destroys every alien planet in the shortest possible time. Your task is to write a program to generate such a plan. The output is the shortest possible time (in years) in which every alien planet is defeated.n nnInputnThere are multiple test cases in the input. The first line of each test case contains two numbers H and A which are the number of planets under the control of humans and aliens respectively (both between 1 and 250). The second line of the test case contains H non-negative integers n1 m1 n2 m2 … nH mH. The number ni is the initial number of Saber Tooth spaceships in the ith human planet and mi is the production rate of that planet. The third line contains A non-negative integers which specify the initial number of mammoths and the production rate of the alien planets in the same format as the second line. After the third line, there are H lines each containing A positive integers. The jth number on the ith line shows how many years it takes a spaceship to travel from the ith human planet to the jth alien planet. The last line of the input contains two zero numbers. Every number in the input except H and A is between 0 and 40000.n nnOutputnThe output for each test case contains a single integer which is the minimum time in which all alien planets can be defeated. If it is impossible to destroy all alien planets, the output should be IMPOSSIBLE.n nnSample Inputn2 1n2 3 0 3n2 2n2n2n0 0n nnSample Outputn6n 问答

MYSQL match against 疑问


rnrn-- phpMyAdmin SQL Dumprn-- version 2.10.2rn-- http://www.phpmyadmin.netrn-- rn-- 主机: localhostrn-- 生成日期: 2013 年 01 月 21 日 03:14rn-- 服务器版本: 5.0.45rn-- PHP 版本: 5.2.3rnrnSET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";rnrn-- rn-- 数据库: `test`rn-- rnrn-- --------------------------------------------------------rnrn-- rn-- 表的结构 `city`rn-- rnrnCREATE TABLE `city` (rn `city_id` int(11) NOT NULL auto_increment,rn `city` varchar(50) NOT NULL,rn `pos` varchar(50) NOT NULL,rn `level` tinyint(4) NOT NULL,rn PRIMARY KEY (`city_id`),rn FULLTEXT KEY `city` (`city`)rn) ENGINE=MyISAM DEFAULT CHARSET=gbk AUTO_INCREMENT=11 ;rnrn-- rn-- 导出表中的数据 `city`rn-- rnrnINSERT INTO `city` VALUES (1, '中国', '1', 1);rnINSERT INTO `city` VALUES (2, '广州天河区', '1,2', 2);rnINSERT INTO `city` VALUES (3, '深圳', '1,3', 2);rnINSERT INTO `city` VALUES (4, '宝安', '1,3,4', 3);rnINSERT INTO `city` VALUES (5, '南头', '1,3,5', 3);rnINSERT INTO `city` VALUES (6, '福田', '1,3,6', 3);rnINSERT INTO `city` VALUES (7, '天河', '1,2,7', 3);rnINSERT INTO `city` VALUES (8, '沙河', '1,2,7,8', 4);rnINSERT INTO `city` VALUES (9, '沙河', '1,2,7,9', 4);rnINSERT INTO `city` VALUES (10, 'hello world my friend', '', 0);rnrnSELECT * rnFROM `city` rnWHERE MATCH (rn`city`rn)rnAGAINST (rn'hello'rn)rnrn上述sql 匹配不了city_id为10的记录 为什么呢? 匹配 AGAINST ('world') 就可以,应该不是长度问题。 求助大神,先谢谢啦!!! 论坛