之前找工作的时候陆陆续续刷了leetcode,后来顺便就总结了下,刚开始准备一篇一篇发到blog上来,后来觉得没必要。
序列数据是非常重要的一种,在很多领域里面都频繁出现,例如:医药,商业,财政,客户行为,教育,安全等等。相关研究可以大致将序列数据的挖掘分为两类,发现序列模式和挖掘周期模式。Agrawal 等人[1]首次提出了挖掘频繁序列模式,利用支持度的概念来发现频繁模式,AprioriALL算法也是一种基于Apriori性质的算法,采用逐层搜索的算法来挖掘模式。这篇论文本身还讲了另外基于Apriori的变种序列模式挖掘算法,AprioriSome和DynamicSome。下面将根据这篇论文和结合自己的理解来说明下AprioriAll算法。总体来说,自我感觉这个AprioriAll算法相当于利用了两次前面提到的Apriori算法,中间包含一个频繁项的映射Map。区别在于其支持度的定义有所区分:本文所述的序列模式的支持度是指支持某特定某次的custom数量,而前面提到的关联规则Apriori算法中的支持度是在项集的交易数量上(就是下面的baskets数量)。
Apriori algorithm是关联规则里一项基本算法。是由Rakesh Agrawal和Ramakrishnan Srikant两位在1994年提出的布尔关联规则的频繁项集挖掘算法(详情:Fast Algorithms for Mining Association Rules)。算法的名字是因为算法基于先验知识(prior knowledge).根据前一次找到的频繁项来生成本次的频繁项。关联规则的目的在于在一个数据集中找出项之间的关系,也称之为购物蓝分析 (market basket analysis)。例如,购买佳能的顾客,有70%的可能也会买在一个月之类买HP打印机。这其中最有名的例子就是”尿布和啤酒“的故事了。
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fans were putting their money where their mouths were, by laying all manner of World Cup bets.
Chinese Football Lottery provided a “Triple Winning” game. The rule of winning was simple: first select any three of the games. Then for each selected game, bet on one of the three possible results — namely W for win, T for tie, and L for lose. There was an odd assigned to each result. The winner’s odd would be the product of the three odds times 65%.
For example, 3 games’ odds are given as the following:
W T L 1.1 2.5 1.7 1.2 3.0 1.6 4.1 1.2 1.1
To obtain the maximum profit, one must buy W for the 3rd game, T for the 2nd game, and T for the 1st game. If each bet takes 2 yuans, then the maximum profit would be (4.1*3.0*2.5*65%-1)*2 = 37.98 yuans (accurate up to 2 decimal places).
Input
Each input file contains one test case. Each case contains the betting information of 3 games. Each game occupies a line with three distinct odds corresponding to W, T and L.
Output
For each test case, print in one line the best bet of each game, and the maximum profit accurate up to 2 decimal places. The characters and the number must be separated by one space.
Sample Input
1.1 2.5 1.7 1.2 3.0 1.6 4.1 1.2 1.1
Sample Output
T T W 37.98
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number.
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop.
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in’s and out’s, you are supposed to find the ones who have unlocked and locked the door on that day.
Input Specification:
Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:
ID_number Sign_in_time Sign_out_time
where times are given in the format HH:MM:SS, and ID number is a string with no more than 15 characters.
Output Specification:
For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.
Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.
Sample Input:
3 CS301111 15:30:28 17:00:10 SC3021234 08:00:00 11:25:25 CS301133 21:45:00 21:58:40
Sample Output:
SC3021234 CS301133
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.
前言:自己平时不玩ACM,保研需要,也做做题目,练练手,C语言也学得不好,C++就直接没学过。浙大复试通知上也是说只能用C或者C++。所以……