题意:给你n个数,有m次操作,每次使得两个数相连接,询问q次,问某两个数是否连接在一起. 题解:这其实是一道并查集的裸题,这里就不再多说了,写个路径压缩的find函数即可. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <stack> #include <que…
Mrs. Panda’s birthday is coming. Mr. Panda wants to compose a song as gift for her birthday. It is known that Mrs. Panda does not like a song if and only if its lyrics contain Xvowels in a row, or Y consonants in a row (Otherwise, Mrs. Panda likes th…
H. Texas hold'em Poker 思路:根据每个牌型分等级,然后排序按照等级优先,最大值次之,次大值,最后比较剩下值的和. #include<bits/stdc++.h> using namespace std; ; struct node{ string name; ; ; ; ; }; node a[maxn]; bool cmp(const node &a, const node &b) { if(a.id != b.id) return a.id >…
题目链接:https://nanti.jisuanke.com/t/41408 题目意思很简单,就是个模拟过程. #include <iostream> #include <cstring> #include <algorithm> #include <cstdio> #include <map> #define rep(i,j,k) for(int i = (j); i <= (k); ++i) #define per(i,j,k) fo…
题目链接:https://nanti.jisuanke.com/t/41305 题目说的很明白...只需要反向跑spfa然后输入-dis,然后添-dis的一条边就好了... #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <map> #include <cmath>…
题意 :给你两个指数类型的数\(A^m\)和\(B^n\),比较他们的大小.保证底数和指数中最多只有一个为0. 题解 :题目数据非常大,肯定不能直接比较.由换底公式和\(Log\)函数的性质我们知道:\(LogA^m=mLogA\),又因为\(Log\)函数是单增的,我们便可以用它来进行大小的比较.这里要注意当底数为0的时候,指数为0可以不用管.还有要记住!!! double类型比较大小会出现精度的问题,不能直接比,要用一个eps!!! 代码: #include <iostream> #inc…
题意:给你一组数,求最长的严格上升子序列及个数(mod 1e9+7) 题解:用动态规划来求LIS,记\(dp[i]\)是数组中第i个位置上的数的LIS最优解,我们遍历一遍原数组,然后找i位置前的LIS,如果\(a[j]<a[i]\)并且\(dp[j]+1>dp[i]\)那么当前i位置的最优解就应该更新成\(dp[j]+1\).然后我们再记一个\(res[i][length]\),表示i位置上长度为length的LIS的个数.最后统计一下长度最长的子序列有多少个就行了. 代码: #include…
目录 终端复用工具--Tmux 一.为什么要用Tmux? 二.tmux是什么? 三.Tmux基本概念 四.Tmux使用规则 1.安装Tmux 2.基本使用 3.自定义配置文件 五.补充 1.tmux man手册 终端复用工具--Tmux 一.为什么要用Tmux? tmux是linux下的管理窗口的程序,那什么是管理窗口?众所周知,linux系统支持远程终端(terminal)连接,(使用终端通过ssh 命令去远程连接服务器,并执行各种命令),看看一下场景: 我们通过终端连接到远程服务器,去执行t…
集合 和 数组 的比较: 数组 - 本质上就是在内存空间中申请的一段连续内存空间,存放多个相同类型的数据 - 数组一旦定义完毕,则在内存空间中的长度固定. - 插入/删除元素时可能导致大量元素的移动,因此效率比较低. - 使用数组下标访问元素非常便利. - 数组中的元素可以是基本数据类型,也可以是引用数据类型. 集合  - 内存空间不一定连续,数据类型不一定相同. - 内存空间的长度不固定,可以动态调整. - 插入/删除元素时可以不移动大量元素,效率可以提高. - 不一定支持下标访问. - 集合…
http://blogs.mathworks.com/loren/2007/03/01/creating-sparse-finite-element-matrices-in-matlab/ Loren on the Art of MATLAB March 1st, 2007 Creating Sparse Finite-Element Matrices in MATLAB I'm pleased to introduce Tim Davis as this week's guest blogge…