
----树状数组
这个好玩吗
Offer已在路上请耐心等待,准备入职的新人
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT(A) - 1057. Stack (30)
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Po原创 2016-11-23 18:04:39 · 332 阅读 · 0 评论 -
POJ - 2481 Cows
考查树状数组 + 排序// 树状数组 + 排序#include <cstdio>#include <string.h>#include <algorithm>#define MAX 100010using namespace std;typedef long long LL;typedef struct { LL x; LL...原创 2017-05-17 21:45:09 · 424 阅读 · 0 评论 -
POJ - 2352 Stars
注意输入有0出现,BIT不好处理,所以在输入的时候加1// 树状数组// http://blog.csdn.net/niushuai666/article/details/7389273#include <cstdio>#include <string.h>#define MAX 32000 + 10using namespace std;typedef...原创 2017-05-17 21:43:47 · 1534 阅读 · 0 评论 -
POJ - 2299 Ultra-QuickSort
利用树状数组求逆序数,但是数据范围比较大,要使用离散化坐标参考:http://blog.csdn.net/guhaiteng/article/details/52138756// 树状数组求逆序数 + 离散化#include <cstdio>#include <string>#include <algorithm>#define MAX 500000...原创 2017-05-13 14:24:15 · 483 阅读 · 0 评论 -
HDU - 2689 Sort it
题目统计逆序数的数量,可以用归并排序。这里利用树状数组求逆序数// 树状数组求逆序数#include #include #define MAX 1000 + 10typedef long long LL;LL c[MAX];LL lowbit( LL i ) { return i & ( -i );}void update( LL i, LL val, LL原创 2017-05-13 14:21:51 · 463 阅读 · 0 评论 -
HDU - 1556 Color the ball
树状数组练习,模版题#include #define MAX 100000 + 10typedef long long LL;LL a[MAX];LL lowbit( LL x ) { return x & ( -x );}LL getSum( LL x ) { LL s = 0; while( x > 0 ) { printf(原创 2017-05-13 14:20:26 · 453 阅读 · 0 评论 -
HDU - 1166.敌兵布阵
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166考查树状数组。#include #include #include #include #define MAX 50000 + 10using namespace std;//int a[MAX];int c[MAX];int lowbit( int原创 2017-01-20 09:24:33 · 341 阅读 · 0 评论 -
HDU - 1754.I Hate It
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754考查线段树。今天刚学习了线段树的知识,看的一知半解...大概原理了解了,拿一道简单题练手下。#include #define MAX ( 200000 + 10 )int num[MAX];typedef struct { int left; i原创 2017-01-20 17:33:53 · 298 阅读 · 0 评论 -
PAT(A) - 1057. Stack (30)
1057. Stack (30)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueStack is one of the most fundamental data structures原创 2016-09-23 20:56:40 · 331 阅读 · 0 评论 -
POJ - 3067 Japan
// 树状数组求逆序数 + 几何关系#include <cstdio>#include <string.h>#include <algorithm>#define MAX 2020using namespace std;typedef long long LL;typedef struct { LL x; LL y;...原创 2017-05-17 21:46:40 · 440 阅读 · 0 评论