I Think I Need a Houseboat
Time Limit: 2 Seconds Memory Limit: 65536 KB
Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land...
分类:
其他好文 时间:
2015-04-28 14:05:09
阅读次数:
184
题目传送门 1 /* 2 BFS+模拟:dp[i][j][p] 表示走到i,j,方向为p的步数为多少; 3 BFS分4种情况入队,最后在终点4个方向寻找最小值:) 4 */ 5 #include 6 #include 7 #include 8 #...
分类:
其他好文 时间:
2015-04-27 21:43:02
阅读次数:
207
这两道题目的类型感觉是一样的 都是利用了容斥的思想 从后往前推然后去重。
HDU 5212 题意 :
给n个数 求出每个数与这n个数分别F(i)的和, F(i) = gcd(a[i], a[j]) * (gcd(a[i], a[j]) - 1).
可以这样考虑 ai与aj互质的时候F()的值是等于0 没必要计算。只要计算以i为gcd的所有的数对的个数 就好了 (1
#include...
分类:
其他好文 时间:
2015-04-27 20:09:01
阅读次数:
139
May Day Holiday
Time Limit: 2 Seconds
Memory Limit: 65536 KB
As a university advocating self-learning and work-rest balance, Marjar University has so many days of rest, including hol...
分类:
其他好文 时间:
2015-04-27 10:06:08
阅读次数:
129
GCD Expectation
Time Limit: 4 Seconds Memory Limit: 262144 KB
Edward has a set of n integers {a1, a2,...,an}. He randomly picks a nonempty subset {x1, x2,…,xm}
(each nonempty subset has...
分类:
其他好文 时间:
2015-04-27 02:04:51
阅读次数:
155
题目传送门 1 /* 2 水题:找排序找中间的价格,若有两个,选价格大的; 3 写的是有点搓:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include...
分类:
其他好文 时间:
2015-04-26 16:40:21
阅读次数:
167
题目传送门 1 /* 2 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了; 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #i...
分类:
其他好文 时间:
2015-04-26 16:37:27
阅读次数:
119
题目传送门 1 /* 2 模拟:手敲map一一映射,累! 3 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #in...
分类:
其他好文 时间:
2015-04-26 15:09:00
阅读次数:
204
题目传送门 1 /* 2 DP:dp 表示当前输入的x前的包含x的子序列的和, 3 求和方法是找到之前出现x的位置(a[x])的区间内的子序列; 4 sum 表示当前输入x前的所有和; 5 a[x] 表示id; 6 详细解释:http:...
分类:
其他好文 时间:
2015-04-26 13:39:49
阅读次数:
140