ICode9

精准搜索请尝试: 精确搜索
  • CF1081C-Colorful Bricks-(dp)2019-07-27 20:02:02

    http://codeforces.com/problemset/problem/1081/C 题意:有n个排成一行板块,有m种颜色,要让这些板块有k对相邻板块不同颜色,有多少种涂色方法? 比如样例2,3块板,2种颜色,1对不同。有4种涂法。[ 1 2 3 ]表示板块位置。 1.黄+绿+绿  2.黄+黄+绿 3.绿+黄+黄 4.绿+绿+黄 为什么是相邻不同?百度

  • 最长上升子序列III--利用二分优化至nlogn2019-07-27 20:00:34

    #include<iostream>#include<algorithm>using namespace std;const int N=100010;int n;int a[N],q[N];int main(void){ cin>>n; for(int i=0; i<n; i++)cin>>a[i]; int len=0; q[0]=-2e9; for(int i=0;i<n;i++){ int l=

  • SDNU 1377.Problem C: Jolly Jumpers(水题)2019-07-27 19:56:42

    Description   Problem C: Jolly Jumpers A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance,   1 4 2 3 is a jolly jumper, becaus

  • [补]2019nowcoder牛客第三场F(暂且)2019-07-27 19:02:25

    红小豆以为自己迈出了历史性的一步,然而并没有_(:з」∠)_   F  Planting Trees   虽然之前说过很多次但是还是要再说一遍:cin不仅跑得慢还跑得螺旋无敌飞天香蕉船慢!!!   赛中快乐写悬线法,然而wa。。然后快乐ctrl c ctrl v 魔改,加了一堆同名不同用途的数组,还是wa。。   写完单

  • Luogu2420 让我们异或吧 (熟练剖分)2019-07-27 19:00:56

    \(dis[u] \bigoplus dis[v] = dis[u] \bigoplus dis[v] \bigoplus dis[lca\{x,y\}] \bigoplus dis[lca\{x,y\}]\) #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define R(a,b,

  • 拼多多笔试:大整数相乘2019-07-27 18:55:06

    题目描述: 有两个用字符串表示的非常大的大整数,算出他们的乘积,也是用字符串表示。不能用系统自带的大整数类型。   输入描述: 空格分隔的两个字符串,代表输入的两个大整数 输出描述: 输入的乘积,用字符串表示 示例1 输入: 72106547548473106236 982161082972751393 输出: 70820

  • POJ1821 Fence --- 单调队列 + DP2019-07-27 18:54:23

    mark~~   1 //#include<bits/stdc++.h> 2 #include<iostream> 3 #include<stack> 4 #include<algorithm> 5 #include<cstdio> 6 #include<cmath> 7 #include<cstring> 8 #define mem(a) memset(a,0,sizeof(a)) 9 #define ll lon

  • 算24点2019-07-27 17:55:51

    #include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <algorithm>#include <string>#include <vector>#include <queue>#include <set>#include <map>#de

  • M - Little Pony and Harmony Chest 状压dp2019-07-27 17:05:33

    M - Little Pony and Harmony Chest  怎么感觉自己越来越傻了,都知道状态的定义了还没有推出转移方程。 首先这个a的范围是0~30   这里可以推出 b数组的范围 0~60 原因很简单,因为这个要求abs(b-a)) 尽量小,所以如果b>=60 那还不如用1 ,因为1 的数量是没有限制的, 当 b>60 abs(b-a)>3

  • A hard puzzle2019-07-27 16:41:02

    Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin. this puzzle describes that: gave a and b,how to know the

  • scanf()与scanf_s的区别2019-07-27 16:40:08

    scanf() 函数 : scanf() 函数是格式化输入函数,它从标准输入设备(键盘) 读取输入的信息。 其调用格式为:scanf("<格式化字符串>",<地址表>)。 scanf_s()函数: scanf_s() 的功能虽然与scanf() 相同,但却比 scanf() 安全,因为 scanf_s() 是针对“ scanf()在读取字符串时不检查边界,可

  • 洛谷P2251质量检测题解2019-07-27 16:37:44

    点击跳转查看题意 由题意显而易见可得,这是一道RMQ的裸题,ST表的建表复杂度为O(nlogn),查询为O(1),能完美跑过此题的数据,这题的题意是查询以每个数为起点长度为m的区间内部的最小值,我们只需要枚举一下起点,每个区间依次查询就好,这题是一道ST表的裸题 #include<cstdio>//100 #inc

  • World Cup Gym - 101194L2019-07-27 16:03:40

    Input file: Standard Input Output file: Standard Ouptut Time limit: 1 second 这是2016 ACM-ICPC Asia China-Final里面的一道水题,当时训练赛时做这道题思路不对,就没做出来。。 题目大意:四支球队进行循环赛,每两支队之间只进行一次比赛,一共进行6场,对于非平局:赢的队伍得3分,输的队

  • P3808 【模板】AC自动机(简单版)2019-07-27 15:57:14

    #include<iostream>#include<cstdio>#include<queue>#include<algorithm>#include<cmath>#include<ctime>#include<set>#include<map>#include<stack>#include<cstring>#pragma GCC optimize(2)#define inf 2147

  • 洛谷P2802题解2019-07-27 15:43:03

    一. 这个题目其实就是简单的DFS运用遍历所有条件即可但是有几点需要注意的地方 1.退出条件需要注意,一开始我设置了一个极大数来退出,后面发现完全没有必要,只需要设置大于N*M,F==0和sum》sums及可。 2. 要先判断血量在来判断目标位置上有什么东西。 只要注意一下,然后直接暴搜

  • 改进的KMP算法2019-07-27 14:38:08

    原文链接:http://www.cnblogs.com/zhuy/archive/2012/04/09/2439652.html   //C.h 几乎各程序都需要用到的文件包含宏命令和使用名空间 #ifndef _C_H_ #define _C_H_ #include <iostream> #include <fstream> #include <iomanip> #include <cmath> #inc

  • hdu 1425 sort2019-07-27 14:37:41

    原文链接:http://www.cnblogs.com/zhuy/archive/2012/07/26/2610287.html sort Time Limit: 6000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16968    Accepted Submission(s): 4977 Problem Des

  • poj2774之最长公共子串2019-07-27 13:42:19

    原文链接:http://www.cnblogs.com/riasky/p/3429155.html   Long Long Message Time Limit: 4000MS   Memory Limit: 131072K Total Submissions: 18794   Accepted: 7744 Case Time Limit: 1000MS   Description The little cat is majoring

  • HDU--杭电--3790--最短路径问题2019-07-27 13:36:22

    原文链接:http://www.cnblogs.com/riasky/p/3458808.html   最短路径问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9418    Accepted Submission(s): 2874 Problem Des

  • ROI2019-07-27 12:53:05

    简单说说ROI,就是抠图(美称感兴趣区域ROI)。详情内容通过讲解代码 任务:实现画面叠化效果(水印或者相同规格叠化) /*利用ROI将一幅图像叠加到另一幅图像的指定位置*/#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.

  • [补]2019nowcoder牛客第一场E、I2019-07-27 12:04:48

    红小豆发现第一场的可以挂出来了owo   E  ABBA   当时读题之后想得很复杂,什么B前面得有n个A,A前面得有m个B,然后就睡着了(x   补题的时候感觉确实是这么个思路,参考了官方题解楼的众位大佬写的题解,比较容易理解的思路大概是这样:     如果当前B的数量没有比A多m个,那么仍可以

  • C. Bracket Sequence(栈模拟 | DP)2019-07-27 11:37:34

    A bracket sequence is a string, containing only characters "(", ")", "[" and "]". A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters

  • 二分图板子2019-07-27 11:03:14

    ①二分图的定义与判定 I.二分图:设G=(V,E)是一个无向图,如果顶点V可分割为两个互不相交的子集(A,B)并且图中的每条边(i,j)所关联的两个顶点i和j分别属于这两个不同的顶点集(i in A,j inB)则称图G为二分图. 以上是度娘对二分图的定义,其实我认为太过正规的定义反而不便于理解,不如直接

  • R - Weak Pair HDU - 5877 线段树2019-07-27 10:51:21

    R - Weak Pair  HDU - 5877  这个题目的初步想法,首先用dfs序建一颗树,然后判断对于每一个节点进行遍历,判断他的子节点和他相乘是不是小于等于k, 这么暴力的算法很自然的超时了。 然后上网搜了一下题解,感觉想的很巧妙。 就是我们要搜 子节点和父节点的乘积小于一个定值的对数。 一

  • Luogu P3901 数列找不同 (莫队模版)2019-07-27 10:03:43

    传送门 这是一个莫队板子qwq 莫队是一种离线暴力算法,每次通过调整当前询问和上次询问的区间的不同的左右端点,并修改答案。 可以看出,调整的越少跑得越快,所以每次先把询问的左右端点排个序,按左端点分块,块相同的按右端点排序 (玄学) 代码如下 #include<cstdio>#include<iostream>#incl

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有