上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页
摘要: 一、康托展开 问题:{1,2,3,4,5}5个数的全排列中,{2,3,1,5,4}排字典序的第几位? 解决:计算{2,3,1,5,4}的康托展开值:x=a[1]*4!+a[2]*3!+a[3]*2!+a[4]*1!+a[5]*0!=1*24+1*6+0*2+1*1+0*0=31, 所以{2,3,1, 阅读全文
posted @ 2018-08-07 11:18 l..q 阅读(157) 评论(0) 推荐(0)
摘要: O(n!) 求长度为n的序列的全排列: ①递归实现:(参考--https://blog.csdn.net/hero_boke/article/details/58637535) #include<cstdio> #include<algorithm> using namespace std; int 阅读全文
posted @ 2018-08-06 21:30 l..q 阅读(146) 评论(0) 推荐(0)
摘要: Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 阅读全文
posted @ 2018-08-06 11:00 l..q 阅读(206) 评论(0) 推荐(0)
摘要: Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence o 阅读全文
posted @ 2018-08-06 09:57 l..q 阅读(161) 评论(0) 推荐(0)
摘要: Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如 阅读全文
posted @ 2018-08-05 18:34 l..q 阅读(210) 评论(0) 推荐(0)
摘要: 题目描述 We have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2≤i≤N) is Vertex Pi.To each vertex in the tree, Snu 阅读全文
posted @ 2018-08-04 17:19 l..q 阅读(200) 评论(0) 推荐(0)
摘要: 题目描述 In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 阅读全文
posted @ 2018-08-03 21:28 l..q 阅读(259) 评论(4) 推荐(0)
摘要: 题目描述 Kanade selected n courses in the university. The academic credit of the i-th course is s[i] and the score of the i-th course is c[i]. At the univ 阅读全文
posted @ 2018-08-03 10:22 l..q 阅读(196) 评论(0) 推荐(0)
摘要: Description 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是 阅读全文
posted @ 2018-08-02 20:59 l..q 阅读(215) 评论(0) 推荐(0)
摘要: 题目描述 In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are 阅读全文
posted @ 2018-07-31 21:12 l..q 阅读(189) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页