![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
杂题
GaoJieVery6
这个作者很懒,什么都没留下…
展开
-
uva 804 Petri Net Simulation 模拟
理解题意后,没有太大难度,直接模拟就好了,没有坑。#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <string>#include <vector>#include <map>u原创 2018-07-17 15:10:11 · 275 阅读 · 0 评论 -
uva 1471 defense lines
如果用O(n^2)是会TLE的,所以只能用O(nlogn)来做。r[i]是以第i个元素为开头的最长连续递增子序列,l[i]是以第i个元素为结尾的最长连续递增子序列。Min[i]是长度为i的最长连续递增子序列的最后一个元素的最小值。Eg:若序列为6 5 4 3 2 1则Min[1]为1。ans = max(ans, r[i] + len - 1 );为什么要减一,读者自己试一试就知道了。for(in...原创 2018-07-11 18:43:44 · 166 阅读 · 0 评论 -
uva 10954 Huffman编码
此题水的惊天地,泣鬼神。。。。#include <cstdio>#include <cstdlib>#include <iostream>#include <queue>using namespace std;int main(){ int n; while(scanf("%d", &n) && n) {..原创 2018-07-11 21:05:39 · 132 阅读 · 0 评论 -
uva 11093 模拟
水题解释一下ljr的“想一想,为什么”#include <iostream>#include <cstdio>#include <cstring>#include <string>#define LL long long intusing namespace std;int a[100000];int dis[100000];int...原创 2018-07-11 22:25:48 · 126 阅读 · 0 评论 -
快速判断二进制编码中“1”有奇数个还是偶数个
先给出代码int odd_ones(unsigned x) { x = x ^ (x >> 1); x = x ^ (x >> 2); x = x ^ (x >> 4); x = x ^ (x >> 8); x = x ^ (x >> 16); return x &...原创 2018-10-21 17:36:16 · 3105 阅读 · 1 评论