题意:问n匹马赛跑,一共有多少结局。
两匹马有三种结局
1. Both first
2. horse1 first and horse2 second
3. horse2 first and horse1 second
做法:
dp[i][j] i代表有几匹马,j代表有多少团。
把一样快的马放在一个团里。 按团算 ,两匹马 有 两种, 平局 一个团,dp[2][1]计数1,不平局,有两个团,dp[2][2]计数2。 三匹马的时候,dp[3][1]=dp[2][1]...
分类:
其他好文 时间:
2015-03-29 10:50:02
阅读次数:
152
sql 求解两个时间差
SELECTDATEDIFF( Second, '2009-8-25
12:15:12', '2009-9-1 7:18:20') --返回相差秒数
SELECTDATEDIFF( Minute, '2009-9-1
6:15:12', '2009-9-1 7:18:20') --返回相差分钟数
SELECTDATEDIFF( Day, '2009-8...
分类:
数据库 时间:
2015-03-28 21:50:03
阅读次数:
255
1,获取本地时间戳
php应用mktime()函数将一个时间转换为UNIX的时间戳值。时间戳是一个长整数,包含了从UNIX 纪元(1070年1月1日),好多时间都是按这个为起始点的,感兴趣的朋友可以搜搜看看,里面肯定有故事哦。
mktime()函数语法格式如下:
int mktime(int time,int minute,int second,int month,int day,int ye...
分类:
Web程序 时间:
2015-03-28 10:13:45
阅读次数:
176
1723. Sandro's Book
Time limit: 0.5 second
Memory limit: 64 MB
It's been quite a number of years since Lich Sandro retired. Sometimes in the evenings, when he feels especially lonely, he ...
分类:
其他好文 时间:
2015-03-22 09:07:52
阅读次数:
147
题意:从C有奶牛中选N头,给出它们的分数scores和资助aid,要是这N头牛的总资助不超过F,同时它们中分数的中位数最大。求这个最大的中位数。
思路:按照分数排序,枚举每头牛作为中位数,计算牛i前面N/2头牛的最小资助和后面N/2牛的最小资助(用到优先队列)。最后从后往前找第一个满足l[i]+r[i]+cow[i].second<=F的即为答案。...
分类:
其他好文 时间:
2015-03-21 17:13:09
阅读次数:
247
1617. Flat Spots
Time limit: 0.5 second
Memory limit: 64 MB
Yekaterinburg has an extensive network of tram routes. Trams of more than ten routes go along some streets. It is clear that ra...
分类:
其他好文 时间:
2015-03-21 17:07:45
阅读次数:
134
第16例:<!--在网页主体中动态却换内容--><title>文件引用</title><divstyle="color:red;"><center><ahref="index.php?id=index">首页</a><ahref="index.php?id=second">简介</a></center></div><?phpsw..
分类:
Web程序 时间:
2015-03-21 14:13:37
阅读次数:
216
题目:
Given a linked list, remove the nth node from the end of list and return its head.For example,
Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked...
分类:
其他好文 时间:
2015-03-21 12:41:53
阅读次数:
115
转载请注明出处:http://www.cnblogs.com/fraud/ ——by fraudApple TransportationTime Limit:1 Second Memory Limit:32768 KBThere's a big apple tree in the forest. I...
分类:
移动开发 时间:
2015-03-20 23:44:19
阅读次数:
260
Beam me out!King Remark, first of his name, is a benign ruler and every wrongdoer gets a second chance after repenting his crimes in the Great Maze!To...
分类:
其他好文 时间:
2015-03-20 20:24:09
阅读次数:
154