算法
wywwzjj
Shell is the only beginning.
展开
-
ACM 常用小 Trick
//{{{ #include#include <algorithm>#include <iostream>#include <cstring>#include <vector&转载 2018-10-28 23:02:47 · 352 阅读 · 0 评论 -
FOJ-集合运算
★实验任务有一天,你正在学习算法与数据结构。突然看到一个很有趣的知识点,集合运算!聪明的你很快的就掌握了并集运算、交集运算和差集运算。这里就出小小的问题帮你检验一下掌握情况吧。给你三组数。当你用集合的定义将他们转化成三个集合 A、B、C 后,如果A 集合与 B 集合能通过上述三种集合运算(并集运算、交集运算和差集运算)得到集合 C。则从小到大输出集合 C 的所有元素,否则输出“What...原创 2018-10-31 21:29:18 · 309 阅读 · 0 评论 -
很优雅的哈夫曼编码实现
#include<bits/stdc++.h>using namespace std;struct Node { char data; int freq; Node *lChild, *rChild; Node(char data, int freq) : data(data), freq(freq) { lChild = rCh...转载 2018-12-28 22:18:19 · 157 阅读 · 0 评论 -
数值分析 部分代码实现
#include <stdio.h>#include <stdlib.h>#include <math.h>#define true 1#define false 0#define zero123 1.0E-20double intf123(double x) { return cos(x); } //用于积分double fode123(...转载 2018-12-31 10:04:07 · 893 阅读 · 0 评论 -
POJ-2352 Stars【树状数组】
原题链接题目大意给出一些星星的二维坐标,求星星左方,下方,左下方的星星个数。思路题目已经把星星按照 y 坐标从小到大排序,若 y 相等则按 x 从小到大排序。因此,在每次对一个星星进行统计时,之前出现过的星星,只要X坐标比其小,则必在其左,下,左下方。代码#include <iostream>using namespace std;const int N = 4e4;...原创 2019-01-02 09:52:33 · 148 阅读 · 0 评论