摘要: A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another 阅读全文
posted @ 2019-02-03 15:50 stul 阅读(101) 评论(0) 推荐(0) 编辑
摘要: FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large 阅读全文
posted @ 2019-02-03 15:47 stul 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He i 阅读全文
posted @ 2019-02-03 15:45 stul 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 在 ACM 能够开展之前,必须准备预算,并获得必要的财力支持。该活动的主要收入来自于 Irreversibly Bound Money (IBM)。思路很简单。任何时候,某位 ACM 会员有少量的钱时,他将所有的硬币投入到小猪储钱罐中。这个过程不可逆,因为只有把小猪储钱罐打碎才能取出硬币。在足够长的 阅读全文
posted @ 2019-02-02 19:59 stul 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://nanti.jisuanke.com/t/36118 环形数组的连续最大子段和,有两种情况。 1.最大和的这个子段没有包含头尾。所以直接dp[i] = max(dp[i-1]+a[i],a[i]) 2.最大和的这个子段包含了头尾。这个时候,最大和 = 累积和 - 连续子段最 阅读全文
posted @ 2019-02-02 17:02 stul 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://nanti.jisuanke.com/t/36116 n个人,最少的门票,n/2张。 mid = (n-1)/2 然后 l = mid, r = n-1。两边比较,模拟一下过程,如果arr[i] * 2 < arr[j] 那就 n--。否则就 l--。去找下一个小于的数看是 阅读全文
posted @ 2019-02-02 15:32 stul 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://nanti.jisuanke.com/t/36117 这个题目想不到用广搜来做,一直在想深搜。 广搜的思路呢,是把最外圈不是黑色(不是0)的数 的位置 i 和 j 进队,赋值为0。然后依次用广搜对最外圈的这些非0点向四个方向搜索。大于0的就继续进队,赋值为0。 100%通过 阅读全文
posted @ 2019-02-02 15:28 stul 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 一天蒜头君得到 nnn 个字符串 sis_isi​,每个字符串的长度都不超过 101010。 蒜头君在想,在这 nnn 个字符串中,以 sis_isi​ 为后缀的字符串有多少个呢? 输入格式 第一行输入一个整数 nnn。 接下来 nnn 行,每行输入一个字符串 sis_isi​。 输出格式 输出 n 阅读全文
posted @ 2019-02-02 11:22 stul 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this 阅读全文
posted @ 2019-02-01 13:51 stul 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 代码很长,思路不难。把四位数拿出来,循环看是不是素数。加上bfs就ok了。 阅读全文
posted @ 2019-01-31 12:11 stul 阅读(89) 评论(0) 推荐(0) 编辑