上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页
摘要: Matches We can make digits with matches as shown below: Given N matches, find the number of different numbers representable using the matches. We shal 阅读全文
posted @ 2016-08-24 16:42 Yan_Bin 阅读(318) 评论(0) 推荐(0)
摘要: Cheerleaders In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during b 阅读全文
posted @ 2016-08-24 15:27 Yan_Bin 阅读(370) 评论(0) 推荐(0)
摘要: 题意:从1~n中选出3个整数,使得他们三边能组成三角形,给定一个n,问能组成多少个不同的三角形? 分析:n最大能达到1000000,所以只能用O(n)来解决。 设最大边为x的三角形个数为C(x),y+z>x , x-y<z<x,当y=1时 z无解,y=2,z一个解……y=x-1,z有x-2个解 所以 阅读全文
posted @ 2016-08-24 01:04 Yan_Bin 阅读(147) 评论(0) 推荐(0)
摘要: Chess Queen You probably know how the game of chess is played and how chess queen operates. Two chess queens are in attacking position when they are o 阅读全文
posted @ 2016-08-24 00:16 Yan_Bin 阅读(215) 评论(0) 推荐(0)
摘要: 给定空间里n(n<=1000)个点,假设任意三个点都不共线。 将任意两点之间的连线涂上红色或者黑色。 问3条边同色的三角形个数。 分析: 由于三角形总数C(n,3),所以求出异色三角形个数就求出了同色三角形个数。 我们发现这样的对应关系,一个异色三角形存在两个顶点,该三角形中与它们相邻的两边是不同色 阅读全文
posted @ 2016-08-23 23:51 Yan_Bin 阅读(617) 评论(0) 推荐(0)
摘要: Minimum Sum LCMLCM (Least Common Multiple) of a set of integers is defined as the minimum number, which is amultiple of all integers of that set. It i 阅读全文
posted @ 2016-08-23 22:36 Yan_Bin 阅读(246) 评论(0) 推荐(0)
摘要: Choose and divideThe binomial coefficient C(m; n) is defined asC(m; n) =m!(m 􀀀 n)! n!Given four natural numbers p, q, r, and s, compute the the resul 阅读全文
posted @ 2016-08-23 22:28 Yan_Bin 阅读(188) 评论(0) 推荐(0)
摘要: Colossal Fibonacci Numbers!Oooh...prettyThe i’th Fibonacci number f(i) is recursivelydefined in the following way:• f(0) = 0 and f(1) = 1• f(i + 2) = 阅读全文
posted @ 2016-08-23 22:06 Yan_Bin 阅读(206) 评论(0) 推荐(0)
摘要: map实例代码: 1 // UVa156 Ananagrams 2 // Rujia Liu 3 // 题意:输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排得到输入文本中的另外一个单词 4 // 算法:把每个单词“标准化”,即全部转化为小写字母然后排序,然后放到map中进行统计 5 阅读全文
posted @ 2016-08-23 12:08 Yan_Bin 阅读(1108) 评论(0) 推荐(0)
摘要: 以point结构体为例 阅读全文
posted @ 2016-08-23 11:01 Yan_Bin 阅读(110) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页