
其他算法
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
ZOJ - 2319——Beautiful People (最长递增子序列LIS算法)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2319 题意:T组数据,每组给出n组数包含(si,bi),选出最多能形成递增序列的数能选多少个。(可以不按顺序选,只需最后选出来的数能在任意排列后能形成严格递增的序列)。 思路:si按从小到大排,bi在si相等的情况下从大到小排。问题就转变成了求bi的最长递增子...原创 2019-04-08 11:00:15 · 144 阅读 · 0 评论 -
HUSTOJ 1009: 第一个简单题(DFS序+树状数组)
题目链接:http://129.211.20.246/problem.php?id=1009 思路:DFS序先处理,然后树状数组维护。 #include<algorithm> #include<string.h> #include<stdio.h> #include<vector> #define ll long long using name...原创 2019-04-29 09:11:21 · 194 阅读 · 0 评论 -
小花梨判连通
小花梨给出原创 2019-05-19 21:16:55 · 159 阅读 · 0 评论 -
最大最小堆
最大最小堆详解:http://cmsblogs.com/?p=4655 个人代码: #include<string.h> #include<stdio.h> #include<algorithm> using namespace std; int a[110],cut=0; void Insert(int x)//堆的插入操作 { a[++cut]...转载 2019-07-25 20:27:48 · 132 阅读 · 0 评论 -
HDU - 2204 (容斥定理)
题目链接:https://vjudge.net/contest/265962#problem 思路:ans=1+n^(1/2)+n^(1/3)+.......n(1/sqrt(n)). n很大,所以打一个素数表,用来枚 #include<iostream> #include<algorithm> #include<math.h> #...原创 2019-08-08 18:39:16 · 210 阅读 · 0 评论 -
HDU - 3208——Integer’s Power (容斥定理+pow精度)
题目链接:https://vjudge.net/contest/9236#problem/B #include<string.h> #include<stdio.h> #include<algorithm> #include<iostream> #define ll long long using namespace std; const dou...原创 2019-08-09 16:40:02 · 161 阅读 · 0 评论 -
Gym - 101955K Let the Flames Begin (约瑟夫环第k个出列的人)
题目链接:https://vjudge.net/contest/330774#problem/K #include<bits/stdc++.h> #define ll long long using namespace std; ll t,n,m,k,carry=1; ll Fibonacci(ll n,ll m,ll k) { ll ans=(k-1)%(n-m+1)+1...原创 2019-10-02 15:23:36 · 364 阅读 · 0 评论