07 2018 档案

摘要:next_permutation 是一个定义在 <algorithm> 中的一个全排列函数, 用于按顺序生成一个数列的全排列 基本用法 : 阅读全文
posted @ 2018-07-30 15:25 楼主好菜啊 阅读(158) 评论(0) 推荐(0) 编辑
摘要:int read() { //输入挂 int x = 0, f = 1; register char ch = getchar(); while (ch'9') { if (ch == '-')f = -1; ch = getchar(); } while (ch >= '0'&&ch <= '9') { x = x * 10 + c... 阅读全文
posted @ 2018-07-30 10:41 楼主好菜啊 阅读(191) 评论(1) 推荐(1) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网题目描述Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., ( 阅读全文
posted @ 2018-07-30 09:06 楼主好菜啊 阅读(1773) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/131/B来源:牛客网 题目描述 矩阵 M 包含 R 行 C 列,第 i 行第 j 列的值为 Mi,j。 请寻找一个子矩阵,使得这个子矩阵的和最大,且满足以下三个条件: 子矩阵的行数不能超过 X 行。 子矩阵的列数不能超 阅读全文
posted @ 2018-07-29 00:02 楼主好菜啊 阅读(232) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/141/E来源:牛客网 题目描述 Eddy likes to play with string which is a sequence of characters. One day, Eddy has played wi 阅读全文
posted @ 2018-07-28 10:39 楼主好菜啊 阅读(165) 评论(0) 推荐(0) 编辑
摘要:哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。 给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什么魔咒时 阅读全文
posted @ 2018-07-28 08:45 楼主好菜啊 阅读(451) 评论(0) 推荐(0) 编辑
摘要:Censor frog is now a editor to censor so-called sensitive words (敏感词). She has a long text p . Her job is relatively simple -- just to find the first 阅读全文
posted @ 2018-07-27 23:55 楼主好菜啊 阅读(165) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include using namespace std; typedef long long ll; pairpp; pair Hash(ll a[21]) { ll ans1=0,ans2=0; for(ll i=0;i<21;i++) ans1=(ans1*1000000013+a[i])%1000000007; for(ll... 阅读全文
posted @ 2018-07-27 18:54 楼主好菜啊 阅读(498) 评论(0) 推荐(0) 编辑
摘要:百度文库 : https://wenku.baidu.com/view/b7d3d1c6804d2b160a4ec090.html 求一个字符串的hash值: •现在我们希望找到一个hash函数,使得每一个字符串都能够映射到一个整数上 •比如hash[i]=(hash[i-1]*p+idx(s[i] 阅读全文
posted @ 2018-07-27 17:03 楼主好菜啊 阅读(253) 评论(0) 推荐(0) 编辑
摘要:Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix has the most elements. Inpu 阅读全文
posted @ 2018-07-26 08:43 楼主好菜啊 阅读(1088) 评论(0) 推荐(0) 编辑
摘要:推荐博客 : https://blog.csdn.net/zuzhiang/article/details/78134247 单调栈、队列只需满足两个条件即可,序列是单调的,并且符合栈和队列的特性。 实现: 例如实现一个单调递增的栈,比如现在有一组数10,3,7,4,12。从左到右依次入栈,则如果栈 阅读全文
posted @ 2018-07-25 18:49 楼主好菜啊 阅读(180) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/131/D来源:牛客网 字符串 S 只包含小写英文字母。有四种操作,每次操作你可以选择其中一种: 删除字符串的第一个字母。 删除字符串的最后一个字母。 在字符串的头部添加任意一个你想要的字母。 在字符串的尾部添加任意一个 阅读全文
posted @ 2018-07-25 14:44 楼主好菜啊 阅读(150) 评论(0) 推荐(0) 编辑
摘要:推荐博客 :https://blog.csdn.net/zzkksunboy/article/details/72600679 作用 线性时间解决最长回文子串问题。 思想 Manacher充分利用了回文的性质,从而达到线性时间。 首先先加一个小优化,就是在每两个字符(包括头尾)之间加没出现的字符(如 阅读全文
posted @ 2018-07-25 10:41 楼主好菜啊 阅读(97) 评论(0) 推荐(0) 编辑
摘要:对于一个数列{ai},如果有i<j且ai>aj,那么我们称ai与aj为一对逆序对数。若对于任意一个由1~n自然数组成的 数列,可以很容易求出有多少个逆序对数。那么逆序对数为k的这样自然数数列到底有多少个? Input 第一行为两个整数n,k。 Output 写入一个整数,表示符合条件的数列个数,由于 阅读全文
posted @ 2018-07-25 08:11 楼主好菜啊 阅读(357) 评论(0) 推荐(0) 编辑
摘要:A . Plague Inc. is a famous game, which player develop virus to ruin the world. JSZKC wants to model this game. Let's consider the world has N\times M 阅读全文
posted @ 2018-07-24 19:46 楼主好菜啊 阅读(498) 评论(0) 推荐(0) 编辑
摘要:推荐博客 : https://blog.csdn.net/CQBZLYTina/article/details/75149587 曼哈顿距离——两点在南北方向上的距离加上在东西方向上的距离,即d(i,j)=|xi-xj|+|yi-yj|。对于一个具有正南正北、正东正西方向规则布局的城镇街道,从一点到 阅读全文
posted @ 2018-07-24 19:43 楼主好菜啊 阅读(619) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/129/A来源:牛客网 有一个长度为n的序列a,已知a[1]=a[n]=1,且对于2 <= x <= n,a[x] / a[x-1]是以下三个数字之一 [ 1,-2,0.5 ],问有多少种不同的序列满足题意。 两个序列不 阅读全文
posted @ 2018-07-23 22:43 楼主好菜啊 阅读(110) 评论(0) 推荐(0) 编辑
摘要:题目描述 小美有一个由n个元素组成的序列{a1,a2,a3,...,an},她想知道其中有多少个子序列{ap1,ap2,...,apm}(1 ≤ m ≤ n, 1 ≤ p1 < p2 ,..., < pm ≤ n),满足对于所有的i,j(1 ≤ i < j ≤ m), apipj < apjpi成立 阅读全文
posted @ 2018-07-08 09:01 楼主好菜啊 阅读(174) 评论(0) 推荐(0) 编辑
摘要:Problem Statement There is an integer sequence of length 2N: A0,A1,…,A2N−1. (Note that the sequence is 0-indexed.) For every integer K satisfying 1≤K≤ 阅读全文
posted @ 2018-07-04 21:16 楼主好菜啊 阅读(252) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/130/B来源:牛客网 黑妹和黑弟又聚在一起玩游戏了,这次他们选择在一个n*m的棋盘上玩游戏,棋盘上的每个方格都有一个非负的分数, 游戏从左上角开始右下角结束,双方交替的选择一个方格并获得方格上相应的分数,一方选择的方格 阅读全文
posted @ 2018-07-02 00:02 楼主好菜啊 阅读(149) 评论(0) 推荐(0) 编辑
摘要:The sequence of integers a1,a2,…,ak is called a good array if a1=k−1 and a1>0. For example, the sequences [3,−1,44,0],[1,−99] are good arrays, and the 阅读全文
posted @ 2018-07-01 08:46 楼主好菜啊 阅读(193) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示